LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
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 03-09-2015, 04:10 PM   #1
normanos
LQ Newbie
 
Registered: Mar 2015
Posts: 2

Rep: Reputation: Disabled
How to get metadata from running mpg123?


Have OpenSuse 12 Linux.
Have software wich using mpg123 as player.
Is it possible to get Song and Artist info from running mpg123 to text file? Maybe from top or htop? All song have ID3 tags.
For example, now it.s playing song:
Quote:
mpg123 -q -s -k 19 /srv/music/song1.mp3
Wish to get "song1" into text file.
Playlist txt file is very specific so can.t get info from it.
Any questions, just ask.
 
Old 03-09-2015, 06:41 PM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Can't you just use something like
Code:
mp3info -p "\"%F\";\"%a\";\"%l\";\"%t\";\n" /srv/music/song1.mp3 >> ~/songs.csv
 
Old 03-09-2015, 10:06 PM   #3
normanos
LQ Newbie
 
Registered: Mar 2015
Posts: 2

Original Poster
Rep: Reputation: Disabled
mpg123 already working. it.s radio automation software. Thats why i need to get info, more i think, from htop.
Screenshot: http://photo.freefm.co.uk/index.php/...03-10-03-01-23

PID of course every next song changing.
Here is part sample from playlist file:
Quote:
Parm 1802.353 1.043 0.025 356.360 355.110 1.00 nextstart=355.235
File /filmas2/muzika/dance/Armin Van Buuren Feat. Sharon Den Adel - In And Out Of Love.mp3

Parm 2396.646 0.260 0.025 402.560 401.310 1.00 nextstart=401.435
File /filmas2/muzika/dance/DJ Ella - Shine Like A Superstar (Bassmonkeys Extended Mix).mp3
BUt for single file mp3info works fine. I.m trying to get info out from running mpg123.

Hope that extra info will helps.
 
Old 03-10-2015, 11:52 AM   #4
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,491

Rep: Reputation: Disabled
Maybe use tee (man tee).
Pipe it into tee thence into a file(?).

Edit: Use >> to add/apend to the file.

Last edited by fatmac; 03-10-2015 at 11:54 AM.
 
Old 03-15-2015, 05:25 AM   #5
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by normanos View Post
Hope that extra info will helps.
It does. First there's different ways to grab the command line args for the running process, pick one:
Code:
\ps --no-header -C mpg123 -o args
Secondly your command line shows the first 5 fields are arguments to mpg123 so we're lazy and use 'cut':
Code:
echo "/$(\ps --no-header -C mpg123 -o args|cut -d '/' -f 2-)" >> ~/songs.log
So that appends the current track title string to the plain text "~/songs.log".
 
  


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
mpg123 pilatus666 Mandriva 10 12-23-2006 05:16 AM
Run mpg123: system("mpg123"); How to know what PID it gets? And a Emacs highlightin q kornerr Programming 10 08-06-2005 10:17 AM
using mpg123 bucovaina78 Linux - Software 1 11-11-2004 04:09 PM
mpg123 doralsoral Linux - Software 9 09-07-2003 09:59 PM
mpg123 doralsoral Linux - Software 1 09-07-2003 07:03 PM

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

All times are GMT -5. The time now is 12:03 AM.

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