PLaylist editor for Linux  (Read 13215 times)

N3Cr0

  • 1337
  • *
  • Posts: 641
  • Country: de
PLaylist editor for Linux
« on: June 08, 2011, 19:59 »
Many Linux users complain about this issue, but the answer can be found only on one hidden website in the whole web, so I decided to write a post about it:

The UT playlist editor doesn't work on linux (at least not in most distributions, e.g. Ubuntu) so you have to work around this issue.

Option 1.: Write a pplaylist by your own
Option 2: I found this shell script, you should be able to execute it from any place of your computer:

Code: [Select]
#!/usr/bin/perl
 #Little Perl Script to generate UT2004 playlists
 #GPL 2 or later
 #by Sk2k4_ops
 print("UT2004 Playlist Generator\nBy sk2k4_ops\@yahoo.com\n\n");
 print("\t1) Generate Windows UPlaylists.ini
 2) Generate Linux UPlaylists.ini
 q) Quit
 choose an option: ");
 chomp($win_lin=<STDIN> );

 if(lc($win_lin) eq 'q'){
 exit();
 }

 while(){
 if(int($win_lin) == '1'){#Windows
 print("Please enter directory <EX: C:\\music\\ >(enter 'q' to quit)\n: ");
 chomp($some_dir=<STDIN> );
 $newdir=$some_dir;
 }
 if(int($win_lin) == '2'){#Linux
 print("Please enter directory (enter 'q' to quit): /");
 chomp($some_dir=<STDIN> );
 $newdir="/$some_dir";
 }

 if(lc("q") eq $some_dir){
 exit();}
 chdir($some_dir);

 if(int($win_lin) == '1'){#Windows
 print("Enter Location of UT2004 <Default is C:\\UT2004> : ");
 chomp($ut2004dir=<STDIN> );
 open(PLAY, ">>$ut2004dir\\System\\UPlaylists.ini") || die "$!";
 }
 if(int($win_lin) == '2'){#Linux
 open(PLAY, ">>$ENV{HOME}/.ut2004/System/UPlaylists.ini") || die "$!";
 }

 opendir(DIR, $newdir) || die "can't opendir $newdir: $!";
 @dots = grep { /.ogg$/i || /.m3u$/i || /.mp3$/i && "$newdir/" } readdir(DIR);
 closedir DIR;

 if(@dots == 0){
 print("\nNo media files in $newdir: ogg(s) , mp3(s), or m3u(s) \n\n");
 next;
 }

 print("Name of New Playlist (Don't use spaces): ");
 chomp($playl=<STDIN> );
 print PLAY "[$playl StreamPlaylist]\nCurrent=0\nbNeedSave=False\n\n";

 my $x=0;
 @ndots=sort(@dots);
 foreach(@ndots){
 if(int($win_lin) == '1'){#Windows
 print "Added:\nPlaylist=$newdir\\@ndots[$x]\n\n";
 print PLAY "Playlist=$newdir\\@ndots[$x]\n";

 }
 if(int($win_lin) == '2'){#Linux
 print "Added:\nPlaylist=$newdir/@ndots[$x]\n\n";
 print PLAY "Playlist=$newdir/@ndots[$x]\n";
 }
 $x++;
 }close(PLAY);
 print PLAY "\n";


 }


In the first menu you can decide if you wanna make a playlist for a Linux or a Windows system - it depends on the paths.
http://n3cr0.itch.io/

xmpp: n3cr0@jabber.ccc.de