LinuxQuestions.org
View the Most Wanted LQ Wiki articles.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 11-16-2003, 05:41 AM   #1
tk31337
Member
 
Registered: Oct 2003
Location: Tucson, AZ
Distribution: Mandrake 10.0 Official
Posts: 193

Rep: Reputation: 31
kplayer doesn't import m3u playlists


Subject may be misleading. This isn't actually a question, but rather a simple hack I created. Kplayer is an MPlayer front-end for KDE with a playlist and some cool features. One feature I immediately noticed missing though, was the lack of importing standard playlists (i.e from XMMS). Kplayer stores a file in the users home directory where it pulls playlist information from. I created a simple shell script which converts a user-specified playlist into the rc file used by kplayer. If the script is named "kconvplaylist" and your playlist "ambientmix.m3u", you'd simply type "kconvplaylist ambientmix.m3u" and, voila, next time you open kplayer your playlist has been imported.

Here's the shell script. Hopefully someone else can get some use out of it as well :-)


#m3u to kplayerplaylistrc conversion script

#Remove comments from m3u (currently ambientmix.m3u for this test)
grep -i '.mp3' $1 > /tmp/test.m3u
grep -i '.ogg' $1 >> /tmp/test.m3u

#Get word count of temp m3u and output to file to be analyzed by cut
wc -l /tmp/test.m3u > /tmp/countraw

#Take out tab by filtering through string
listcount=$(cat /tmp/countraw)
echo $listcount > /tmp/countraw

#Print out first line in file
echo '[Playlist Entries]' > ~/.kde/share/config/kplayerplaylistrc

#Print out total Entries line
echo 'Entries='$(cut -d' ' -f1 /tmp/countraw) >> ~/.kde/share/config/kplayerplaylistrc

#Reset variable
a=-1

#Main loop to number and label lines
cat /tmp/test.m3u | while read cur_line
do
let "a=$a + 1"
echo "Entry $a=$cur_line" >>~/.kde/share/config/kplayerplaylistrc
done

#Cleanup
rm -rf /tmp/countraw
rm -rf /tmp/test.m3u
exit 0
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
configure kplayer jupiter3437 Linux - Software 3 08-29-2005 06:39 PM
XMMS made M3U playlists rael_kid Linux - Newbie 6 06-01-2005 11:52 AM
Import sys ?bash: import: command not found joirnange Linux - Newbie 4 12-28-2004 11:33 PM
burn multiple m3u playlists statmobile Linux - Newbie 1 07-23-2004 04:42 PM
installing kplayer-0.3.1 in redhat 9 tuxfood Linux - Software 1 10-11-2003 03:57 AM


All times are GMT -5. The time now is 01:06 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration