apple ipod touch 1g on slackware shows garbled filenames for my music files
SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
strings filename.mp3 | head
&&
strings filename.mp3 | tail
edited:
i dont see anything added there and my filenames remain the same as before.....
ok lets rewind a bit... you mention you got id3lib installed. did it create the requisite id3info executable ?
when you run it against an mp3 file does it print out to the screen the labels of the artist/song name/album/year/track number/... information ? e.g.:
Code:
[schneidz@hyper music]$ id3info soca/machal-mantano--single-forever.mp3
*** Tag information for soca/machal-mantano--single-forever.mp3
=== TIT2 (Title/songname/content description): 08-single forever
=== TPE1 (Lead performer(s)/Soloist(s)): k.i. / machal montano
=== TALB (Album/Movie/Show title): carnival
=== TYER (Year): 2012
=== TRCK (Track number/Position in set): 8
*** mp3 info
MPEG1/layer III
Bitrate: 56KBps
Frequency: 48KHz
id3info is not designed to change filenames. it is designed to read id3 info from a media file and display it to the screen. a user can capture that information and use it to rename files within a bash script if they so choose.
the strings test was just a low-level way of determining if apple retained the id3 info in the individual mp3 files or if they stored them inside of some it00nz database so that users would be forced to use it00nz to determine song names.
id3info is not designed to change filenames. it is designed to read id3 info from a media file and display it to the screen. a user can capture that information and use it to rename files within a bash script if they so choose.
the strings test was just a low-level way of determining if apple retained the id3 info in the individual mp3 files or if they stored them inside of some it00nz database so that users would be forced to use it00nz to determine song names.
thanks for the info....and i have posted my id3info for a file...
here is the next issue i face before i write that mapping request and renaming script.....
was checking some files and found out that all files dont have tag info...for example below output....
Code:
bash-4.2# id3info TYJA.mp3
*** Tag information for TYJA.mp3
bash-4.2#
edited: well will leave them default as is for now....
thanks...thinking of python....havent tried it yet....well this script will get me going....
Last edited by nitecrawler; 01-14-2015 at 10:03 AM.
thanks for the info....and i have posted my id3info for a file...
here is the next issue i face before i write that mapping request and renaming script.....
was checking some files and found out that all files dont have tag info...for example below output....
Code:
bash-4.2# id3info TYJA.mp3
*** Tag information for TYJA.mp3
bash-4.2#
that sux... i wonder what this will show
Code:
strings TYJA.mp3 | head && strings TYJA.mp3 | tail
probably nothing but binary gibberish.
so maybe this suspicion is correct:
Quote:
Originally Posted by schneidz
...
the strings test was just a low-level way of determining if apple retained the id3 info in the individual mp3 files or if they stored them inside of some it00nz database so that users would be forced to use it00nz to determine song names.
if you are really determined to get the songs off of it00n$, maybe you can hunt around in your ifone and look for any file that may resemble some song list database and try to hax thru it (knowing apple it probably wont be some easy to read text file) ?
strings TYJA.mp3 | head && strings TYJA.mp3 | tail
probably nothing but binary gibberish.
so maybe this suspicion is correct:
if you are really determined to get the songs off of it00n$, maybe you can hunt around in your ifone and look for any file that may resemble some song list database and try to hax thru it (knowing apple it probably wont be some easy to read text file) ?
do i have to check anything more or just get started with the python script as suggested by @schneidz?
and one more thing how do i transfer a few songs that i listen to this ipod?cos i dont understand the fn folders named like F01, FO2 etc? do help me on the transfer part first...
shall i start a new thread for the same???
do i dig into the database file like suggested?
need it solved somehow...and no, not with virtual machine and windows on it or gtkpod but from cli..feel at ease and at home grounds only when its shady out there....
let me be frank....getting fn desperate about it too...do help me out...will be back soon....
i dont own an ipod (one of the reasons why i bought a creative zen vision:w was because its easier to transfer videos via usb (that and the video ipod hadnt existed yet)).
and i chose android instead of ifone because usb transfers are easier. apple on linux is always going to be an uphill battle.
what are you trying to do ?
i would first identify the mechanism that apple uses to map filenames to song information (i assume there is some (encrypted?) file which contains that info).
to transfer files: are you able to successfully use the cp command to transfer files to any of those F01, FO2, ... directories. if so i think getting it to actually play on the device is contingent on updating the song information in the hypothetical song database file.
Distribution: Slackware64 15.0 (started with 13.37). Testing -current in a spare partition.
Posts: 935
Rep:
Quote:
Originally Posted by nitecrawler
Code:
id3info /mnt/my_ipod/iTunes_Control/Music/F03/ELJQ.mp3
*** Tag information for ELJQ.mp3
=== TALB (Album/Movie/Show title): The Essential Judas Priest
=== TPE1 (Lead performer(s)/Soloist(s)): Judas Priest
=== TPE2 (Band/orchestra/accompaniment): JUDAS PRIEST
=== COMM (Comments): ()[eng]: Tags edt. by herguim
=== TCON (Content type): Heavy Metal
=== TIT2 (Title/songname/content description): Breaking The Law
=== TRCK (Track number/Position in set): 02
=== TYER (Year): 2006
=== APIC (Attached picture): ()[, 0]: image/jpeg, 67134 bytes
=== COMM (Comments): (ID3v1 Comment)[XXX]: Tags edt. by herguim
*** mp3 info
MPEG1/layer III
Bitrate: 64KBps
Frequency: 48KHz
If you can retrieve the tag info, then this script could help.
I didn't test it extensively, so you would test it with some files and folders first.
The script relies on the tag information, so you must pay attention
in files with blank fields or generic fields like
"=== TALB (Album/Movie/Show title): "
or
"=== TPE1 (Lead performer(s)/Soloist(s)): "
or
"=== TALB (Album/Movie/Show title): Album"
or
"=== TPE1 (Lead performer(s)/Soloist(s)): Artist"
There's a character substitution to replace '/' for '-', and other annoying characters in Linux,
as well some forbidden characters in Windows.
Hope this helps
Code:
#!/bin/bash
if [ "$1" = '--apply' ]; then
read -p"
Files will be copied and renamed. Confirm (y/n)? "
[[ "$REPLY" =~ ^[yY] ]] || exit
else
read -p"
This is a '--dry-run'.
Check if it's all right and run '$0 --apply' to apply the changes.
The original files won't be deleted, just copied.
<any key to continue>
"
fi
source_dir="$HOME/Music" # Maybe /mnt/my_ipod/iTunes_Control/Music
target_dir="$HOME/Music"
forbidden_characters(){
aux=$(sed -e "y/{}()<>\"/[][][]'/" -e 's/?//g; s/#//g' <<<"$2"|tr '\\/:*|' -)
eval $1'=$aux'
}
big_list=$(find "$source_dir" -type f -name *.mp3)
while read line; do
file=$(id3info "$line")
track=$([[ $(grep TRCK <<<"$file") =~ :\ (.+) ]] && \
echo ${BASH_REMATCH[1]})
title=$([[ $(grep TIT2 <<<"$file") =~ :\ (.+) ]] && \
echo ${BASH_REMATCH[1]})
forbidden_characters title "$title"
album=$([[ $(grep TALB <<<"$file") =~ :\ (.+) ]] && \
echo ${BASH_REMATCH[1]})
forbidden_characters album "$album"
year=$([[ $(grep TYER <<<"$file") =~ :\ (.+) ]] && \
echo ${BASH_REMATCH[1]})
artist=$([[ $(grep TPE1 <<<"$file") =~ :\ (.+) ]] && \
echo ${BASH_REMATCH[1]})
forbidden_characters artist "$artist"
if [ "$1" != '--apply' ]; then
cat <<-EOF
File
$line
will be copied to
$target_dir/$artist/$year $album/$track. $title.mp3
EOF
else
[ ! -d "$target_dir/$artist/$year $album" ] && {
mkdir -p "$target_dir/$artist/$year $album";}
cp -v --preserve=all \
"$line" "$target_dir/$artist/$year $album/$track. $title.mp3"
fi
done <<<"$big_list"
Distribution: Slackware64 15.0 (started with 13.37). Testing -current in a spare partition.
Posts: 935
Rep:
Quote:
Originally Posted by schneidz
^ according to his response #34 not all of his files have id3tag info embedded in them.
Thanks for pointing this out, I didn't note.
Skipping those, nitecrawler can deal with those files later.
There are log files now, 'files-not-renamed' for files with missing tag fields,
'files-that-will-be-renamed_"$Date"' is a log for the '--dry-run'
and 'files-renamed_"$Date"' is a log with files actually renamed.
Code:
#!/bin/bash
if [ "$1" = '--apply' ]; then
read -p"
Files will be copied and renamed. Confirm (y/n)? "
[[ "$REPLY" =~ ^[yY] ]] || exit
else
read -p"
This is a '--dry-run'.
Check if it's all right and run '$0 --apply' to apply the changes.
The original files won't be deleted, just copied.
<any key to continue>
"
fi
source_dir="$HOME/Music" # Maybe /mnt/my_ipod/iTunes_Control/Music
target_dir="$HOME/Music"
Date=$(date +%F_%T|tr : -)
forbidden_characters(){
aux=$(sed -e "y/{}()<>\"/[][][]'/" -e 's/?//g; s/#//g' <<<"$2"|tr '\\/:*|' -)
eval $1'=$aux'
}
big_list=$(find "$source_dir" -type f -name *.mp3)
while read line; do
file=$(id3info "$line")
track=$([[ $(grep TRCK <<<"$file") =~ :\ (.+) ]] && \
echo ${BASH_REMATCH[1]})
title=$([[ $(grep TIT2 <<<"$file") =~ :\ (.+) ]] && \
echo ${BASH_REMATCH[1]})
album=$([[ $(grep TALB <<<"$file") =~ :\ (.+) ]] && \
echo ${BASH_REMATCH[1]})
year=$([[ $(grep TYER <<<"$file") =~ :\ (.+) ]] && \
echo ${BASH_REMATCH[1]})
artist=$([[ $(grep TPE1 <<<"$file") =~ :\ (.+) ]] && \
echo ${BASH_REMATCH[1]})
# Skip files whitout tag. Just one missing field is enough to skip.
if [ ! "$track" -o ! "$title" -o ! "$album" -o ! "$year" -o ! "$artist" ]; then
echo -e "\nMissing tag: $line"|tee -a files-not-renamed
continue
fi
forbidden_characters title "$title"
forbidden_characters album "$album"
forbidden_characters artist "$artist"
if [ "$1" != '--apply' ]; then
cat <<-EOF|tee -a files-that-will-be-renamed_"$Date"
File
$line
will be copied to
$target_dir/$artist/$year $album/$track. $title.mp3
EOF
else
[ ! -d "$target_dir/$artist/$year $album" ] && {
mkdir -p "$target_dir/$artist/$year $album";}
echo | tee -a files-renamed_"$Date"
cp -v --preserve=all \
"$line" "$target_dir/$artist/$year $album/$track. $title.mp3"|
tee -a files-renamed_"$Date"
fi
done <<<"$big_list"
yes am late as usal...so here is my delayed response...
after months i get to sit back on my system with some time at hand....
i do a copy of the file and the file gets transferred to this F01 folder but nothing happens to my song listing in my ipod..
it doesnt get added there in the list....
specifically, the mv command copies my song to the ipod and when i do and ls i see it there...
now in the ipod if i check if the song is listed it isnt shown yet....
i would like to tell you the short folder structure....
/itunes_Control/iTunes
has files like iTunesDB but when i open it in nano its garbage values there...editor not able to read that file....stumped..
Edit plus: its the itunesDB file that needs to be edited..but i cant seem to read it as its gibberish...so guess the song should e playing if i get this part fixed....yeh and its one hell of a part to get through
Last edited by nitecrawler; 03-12-2015 at 06:24 AM.
Reason: further reading
i opened the file ie. itunesdb in vi editor and now i can see paragraphs as a grid and yes thats the file i need to edit to add songs...each grid is one song in the ipod.....but how could i possible understand this code?
You won't be able to edit that file in a normal text editor because it's a binary file, not a text file. I tried doing some quick searches on what format it is in, but came up empty. You might try using sqlite, but I have no idea if it will work.
Unfortunately, I think you're going to have a monumentally difficult time doing this by CLI, and I doubt it's documented anywhere short of looking at the source of programs that provide drag and drop. I think your best bet is to switch to a GUI program like gtkpod, banshee, or amarok, or sell that iPod Touch and get a player that does support UMS (USB Mass Storage), as that will be infinitely easier to use in Linux in the CLI.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.