📜 ⬆️ ⬇️

Podget + rsync + BashPod + GUI = KBashPod for podkastofilov

Introduction


In the last series, we told you about how FineReader was going to “kill” . However, this was not the first initiative of our duet. This time the center of our narration will be the KbashPod program. Which is designed for Linux users who constantly listen to podcasts on their PC and mobile devices.


Each of the authors of the program devotes some time listening to podcasts. At what in the process of listening involved both mobile devices and stationary PC. And in the process itself, tasks such as:

The first three items are solved without problems by the console utility podget, the last rsync. Well, by itself, all these tasks are solved by two programs, it was logical to combine one script, the author of which is mr-protos .

Article Mr-Protos about creating BashPod


This article is intended for experienced Linux users and questions about installing packages, creating an executable file, and choosing a text editor to edit configuration files are omitted.

So, let's begin
')
The following packages must be installed on the system:

Note:
The libnotify-bin package is needed for pop-up notifications that show key script actions or report an error. The name of this package may differ in different distributions, or it may be part of the libnotify package.

Podget setup

Run podget in the console to automatically create configuration files and interrupt its operation with Ctrl + C

Edit the file ~ / .podget / podgetrc (default parameters are omitted):

We set the download site for podcasts

dir_library=" "

Comment the line, because for our purposes there is no need to create a playlist

#playlist_namebase=New-

Turn on the removal of old podcasts

cleanup=1

Set the number of days to keep files before cleaning

cleanup_days=7

If you use the FAT32 file system, you should uncomment the line to delete characters in the name of files that are prohibited in this file system. I recommend in any case to uncomment it and add the% symbol there for a more aesthetic preservation of file names (even if the file system allows using such symbols)

filename_badchars=!#$^&=+{}[]:;"'<>?|\

We set the minimum amount of free disk space at which the download will be stopped. In this example, 600MB

min_space=614400

Edit the list of podcast addresses to download (~ / .podget / serverlist):

We comment on all the lines of this file if we are not interested in podcasts recorded there by default.

We add lines of the necessary podcasts by the principle:

<> <> <>

For example:

russianubuntupodcast.rpod.ru/rss_ynq_bbb4.xml Linux_Podcasts Russian Ubuntu Podcast

Notes:


Creating a bash script

Create an executable bash script (bashpod.sh) to synchronize downloaded podcasts with an mp3 player or phone in flash drive mode:

#!/bin/bash
PODDIR="/ / /"
DEVICEDIR="// / mp3/"

notify-send 'Bashpod' ' ' ; podget -s &&
notify-send 'Bashpod' ' ' ; rsync -ruq --del "$PODDIR" "$DEVICEDIR" && notify-send 'Bashpod' '' || notify-send 'Bashpod' ' '


This script synchronizes downloads podcasts, deletes old ones and synchronizes them with the mp3-player. In the above script, there is the possibility of deriving low-informative error messages, which should be caught by running the script from the console.

Now we create a button on the panel and a menu item with the means of your DE, where we write the name and path to the script bashpod.sh.

KBashPod


Well, as usual, I wanted to turn it all back into a beautiful wrapper with a beautiful appearance. So the idea of ​​the KbashPod was born for those to whom the console was not enough. And now when mounting media, you can immediately select one of the actions to synchronize podcasts using the friendly KBashPod interface.

The main configuration options are available in the GUI, such as:





In addition, thanks to the refinement of the source bash script code, KBashPod has its own podget utility configuration files located in the /.kbashpod directory. This allows you to independently use the utility and KBashPod. It also eliminates the need to pre-edit the ~ / .podget / podgetrc and ~ / .podget / serverlist files described at the beginning of this article.

In the new version (1.1) of the program, integration with KDE Solid was added, and now when a new removable media is detected, it is proposed to launch KBashPod to synchronize podcasts. And by default, the program already presets a link to a podcast from one of the authors of the article ( b0noI ), It-sexual, about which you can learn more details on the podcast page .

Links



The authors

Source: https://habr.com/ru/post/109296/


All Articles