gmusicbrowser Forum

Main board => Questions => Topic started by: 4L3X on January 30, 2021, 17:20:49

Title: Copy tracks to iPod via export plugin and gnupod_addsong command
Post by: 4L3X on January 30, 2021, 17:20:49
Been loving gmusicbrowser ever since and I am happy to see it being more alive recently.

I am using old hacked iPods, just because they are so great with a SSD and new battery.

I have been looking into ways to sync my playlists or filters from gmb to my iPod.
The manual way via gtkpod is so akward that I spent some time today to get the sync working out of gmb directly onto my ipod.

Here is what I used to do before:
- create playlist in gmb (via labels/filter)
- give playlist a name
- copy name
- mark all tracks in playlist
- export as M3U to a certain folder (paste name for filename)
- open gtkpod
- manually add playlist to my iPod
- save changes
when altering the playlist I would go through the procedure again - for every playlist...

Using two programs is counter-intuitive.
So, here is what I figured out today to make copying to my iPod feasible directly within gmb:

- install gnupod (gnupod-tools)
- Open gmb preferences > plugins > export
- check to execute a command on files
- give command a name for the context menu
- Use this command:
bash /path/to/script/gnupod_add_mktunes $files
The bash script looks something like this:
#!/bin/bash
for arg; do
gnupod_addsong -m /media/user/iPod --decode=mp3 "$arg"
done
mktunes -m /media/user/iPod

The script adds all files selected within gmb (converts FLAC to MP3 on-the-fly, YES!) and then finally syncs the iPod Database via the gnupod's mktunes command.

I made this script because I couldn't figure out how to execute two commands in a row, such as:
gnupod_addsong -m /media/user/iPod --decode=mp3 $files && mktunes -m /media/user/iPodgmb would try to interpret everything after $files as a filename also, which would throw errors.

Then use the contect menu in gmb to execute the command.
Watch the progress by running gmusicbrowser -verbose in a terminal.


So that is how one could copy files to an iPod directly from gmusicbrowser.


Now, what I still could not figure out is how to sync plalists/filters onto the iPod.
Does anyone have an idea how this could be done.

gnupod-tools suggest to manually edit the file iPod_Control/.gnupod/GNUtunesDB (It's a XML File).
Source: https://www.gnu.org/software/gnupod/gnupod.html#SEC15 (https://www.gnu.org/software/gnupod/gnupod.html#SEC15)
I am not sure how to script this.
If only there was a variable for gmusicbrowser that is the name of the playlist I could write a script.
Is there any? Like %playlistname ...



Title: Re: Copy tracks to iPod via export plugin and gnupod_addsong command
Post by: MountainX on February 26, 2022, 22:32:06
Thank you for this post, OP. 

I am seeking to do the same thing, but syncing the playlist to my Android device. Does anyone know of an existing solution? Or do I need to create something like the OP did for his iPod?
Title: Re: Copy tracks to iPod via export plugin and gnupod_addsong command
Post by: Quentin Sculo on March 02, 2022, 02:18:57
MountainX couldn't post a reply because of a forum error so he posted his answer there : https://www.reddit.com/r/linuxquestions/comments/t2e28b/how_to_copy_music_files_and_playlist_to_android/hym0jve/?context=3

Let's see if I can post this reply...