LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 11-11-2019, 07:46 AM   #1
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Question Rename mp3 file from it's id3 title?


There are many examples of updating the id3 title of an mp3 file from it's filename, I want to do the converse.

Namely I want a command that takes the id3 title and renames the actula file to the title.

The converse of this which takes the file name and updates the title:
Code:
for i in *.mp3; do echo "${i}"; id3tool -t "${i::-4}" ${i}; done
 
Old 11-11-2019, 09:05 AM   #2
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
n/m

ok I put this back

Code:
while read z
do
   title="$(exiftool -p '$Title' "$z")"
   path=${z%/*}
   ext=${z##*.}
   mv -v "$z" "$path"/"$title"."$ext"
done< <(find /path -type f -name "*.mp3")

I removed my comment because your loop works.

Last edited by BW-userx; 11-11-2019 at 09:40 AM.
 
Old 11-11-2019, 09:08 AM   #3
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
what are you talking about? converse ??

Maybe obverse was better but maybe not! How about reverse or maybe I meant conversally???!!!??? spelling?

Yep, english was never my best subject - maths physics chemistry at school followed by Aero Engineering at uni!
 
Old 11-11-2019, 09:12 AM   #4
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by BW-userx View Post
are you saying you want to have a conversation on now to use a meta tag title to rename a file by that value?
Code:
while read z
do
   title="$(exiftool -p '$Title' "$z")"
   path=${z%/*}
   ext=${z##*.}
   mv -v "$z" "$path"/"$title"."$ext"
done< <(find /path -type f -name "*.mp3")
not tested, and no error checking included.
Looks good to me, thanks, I'll give it a go and it and talking about Engrish how about 'now to use'! Touche on my converse - hehehehe - GSOH

Check out engrish.com
 
Old 11-11-2019, 09:21 AM   #5
dugan
LQ Guru
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 11,249

Rep: Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323Reputation: 5323
Have you looked into this?

https://beets.io/
 
Old 11-11-2019, 09:40 AM   #6
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Thumbs up

Quote:
Originally Posted by dugan View Post
Have you looked into this?

https://beets.io/
No, but I've just looked and it may be useful, thanks
 
Old 11-11-2019, 09:44 AM   #7
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
There is more than one meaning of converse. An alternate meaning means reversed.

https://www.thefreedictionary.com/converse


Code:
con·verse 2  (kən-vûrs′, kŏn′vûrs′)
adj.
Reversed, as in position, order, or action; contrary.
n. (kŏn′vûrs′)
1. Something that has been reversed; an opposite.
2. Logic A proposition obtained by conversion.
[Latin conversus, past participle of convertere, to turn around; see convert.]
con·verse′ly adv.
Quote:
what are you talking about? converse ??

Maybe obverse was better but maybe not! How about reverse or maybe I meant conversally???!!!??? spelling?

Yep, english was never my best subject
It is not your English that is at fault. It is BW's.
 
1 members found this post helpful.
Old 11-11-2019, 12:00 PM   #8
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
Quote:
Originally Posted by tofino_surfer View Post
There is more than one meaning of converse. An alternate meaning means reversed.

https://www.thefreedictionary.com/converse


Code:
con·verse 2  (kən-vûrs′, kŏn′vûrs′)
adj.
Reversed, as in position, order, or action; contrary.
n. (kŏn′vûrs′)
1. Something that has been reversed; an opposite.
2. Logic A proposition obtained by conversion.
[Latin conversus, past participle of convertere, to turn around; see convert.]
con·verse′ly adv.


It is not your English that is at fault. It is BW's.
pointing fingers now hum???

I first thought reverse then looked it up, sooo whatever converse
i did the converse .. la la la it is not normal daily used english. that word, in that context of trying to convey a thought in order for someone else to act on it. in the meaning of doing the opposite of

therefore taking what you said

Quote:
The converse of this which takes the file name and updates the title:
Code:
for i in *.mp3; do echo "${i}"; id3tool -t "${i::-4}" ${i}; done
to to the opposite of this which takes the file name and updates the title:

to then take the title and update the filename.

which in plain english would have been better said.

How do I take the metadata title of a file and make it the name of the file as well?

Last edited by BW-userx; 11-11-2019 at 12:04 PM.
 
1 members found this post helpful.
Old 11-11-2019, 12:17 PM   #9
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Cheers folks <-> sklof sreehC

and a few more palindromes that work:

madam i'm adam

a man a plan a canal panama

Able was I, I saw Elba

You can cage a swallow can't you, you can't swallow a cage can you

Any more folks....
 
Old 11-11-2019, 12:29 PM   #10
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
side tracking.. but it is your thread.....
 
Old 11-12-2019, 01:57 AM   #11
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by GPGAgent View Post
There are many examples of updating the id3 title of an mp3 file from it's filename, I want to do the converse.

Namely I want a command that takes the id3 title and renames the actula file to the title.

The converse of this which takes the file name and updates the title:
Code:
for i in *.mp3; do echo "${i}"; id3tool -t "${i::-4}" ${i}; done
OK, so what exactly is it you want to do?

id tag title => filename (so essentially renaming the file)
or
filename => id tag title
???

The code snippet suggests you want: filename => id tag title.
Correct?
Why does it not work?
 
Old 11-12-2019, 05:34 PM   #12
GPGAgent
Senior Member
 
Registered: Oct 2018
Location: Surrey UK
Distribution: Mint 20 xfce 64bit
Posts: 1,026

Original Poster
Blog Entries: 3

Rep: Reputation: 133Reputation: 133
Quote:
Originally Posted by ondoho View Post
OK, so what exactly is it you want to do?

id tag title => filename (so essentially renaming the file)
or
filename => id tag title
???

The code snippet suggests you want: filename => id tag title.
Correct?
Why does it not work?
I want file to be renamed by the tag title.
 
Old 11-12-2019, 06:26 PM   #13
BW-userx
LQ Guru
 
Registered: Sep 2013
Location: Somewhere in my head.
Distribution: Slackware (15 current), Slack15, Ubuntu studio, MX Linux, FreeBSD 13.1, WIn10
Posts: 10,342

Rep: Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242Reputation: 2242
exiftool
Code:
$ for i in *.mp3 ; do title="$(exiftool -p '$Title' "$i")" ; echo "$title";  echo "mv "$title" "${i%.*}.mp3""   ; done
you'd have to remove the echo " " part and make sure you "quote" your vars.

Last edited by BW-userx; 11-12-2019 at 06:28 PM.
 
Old 11-13-2019, 01:14 AM   #14
ondoho
LQ Addict
 
Registered: Dec 2013
Posts: 19,872
Blog Entries: 12

Rep: Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053Reputation: 6053
Quote:
Originally Posted by GPGAgent View Post
I want file to be renamed by the tag title.
Sorry but I do not understand your reply.
From the 2 options I gave, which one do you want? point it out exactly, please.
 
Old 11-13-2019, 10:52 AM   #15
tofino_surfer
Member
 
Registered: Aug 2007
Posts: 483

Rep: Reputation: 153Reputation: 153
Quote:
Originally Posted by GPGAgent View Post
I want file to be renamed by the tag title.

Sorry but I do not understand your reply.
From the 2 options I gave, which one do you want? point it out exactly, please.
They already did. One of your own two options was

Quote:
id tag title => filename (so essentially renaming the file)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Bash script to set title of MP3 file equal to name of MP3 file jwbales Linux - General 7 09-15-2013 09:20 PM
saving id3 tag from mp3 file fstephens Linux - Newbie 3 04-07-2007 01:52 PM
Multimedia: ID3 "Supper Tagging" for Linux? app to retrieve missing ID3 info? CoolAJ86 Linux - Software 3 10-10-2005 05:53 PM
under with title and sub title the "GTK devel" found in fc3? AKAKAK Fedora 3 02-27-2005 05:51 AM
Software to rename MP3's according to ID3 Tags? Meowatilla Linux - Newbie 7 01-21-2005 04:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration