AutoHotkey Community

It is currently May 26th, 2012, 5:03 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 1 post ] 
Author Message
PostPosted: February 23rd, 2009, 6:52 pm 
Offline

Joined: September 15th, 2006, 10:25 am
Posts: 567
when i listen to music on my mobile, i just delete songs which i dont like from the playlist..

then i run this script on the saved playlist and it marks the songs that are not present in the playlist as deleted..

alongwith such a script for PC (winamp) i can remove the songs i dont like from the disk!

i dont know how many will be benefited, but here's the code..

Code:
/*
; Select only files that are there in the specified .m3u playlist
; The other files will have an extension ".del" so that you know the deleted songs
*/


Inputfile = delete.m3u
ifnotexist, %Inputfile%
{
 FileSelectFile, Inputfile,1,,Select playlist..,Playlists (*.m3u)
 if Errorlevel
  ExitApp
}
SplitPath, Inputfile,,,,,InDrive  ;Get drive
if not InDrive
  Splitpath,A_ScriptDir,,,,,InDrive
Loop, Read, %InputFile%
{
 StringLeft, FirstLetter, A_LoopReadLine, 1
 if FirstLetter=`#
  continue
 if FirstLetter=`\
  FilePath := InDrive . A_LoopReadLine
 else
  FilePath := A_LoopReadLine
 SplitPath, FilePath,,tPath
 if tPath != oPath
  {
   oPath := tPath
   if Paths
    Paths .= "|" . oPath
   else
    Paths := oPath
  }
 FileMove, %FilePath%, %FilePath%.sel
}

if not Paths
  Paths=|
Loop,Parse,Paths,|
{
  Loop,%A_LoopField%\*.mp3
  {
   FileMove,%A_LoopFileFullPath%,%A_LoopFileFullPath%.del
  }
}

Loop,Parse,Paths,|
{
  Loop,%A_LoopField%\*.sel
  {
   StringTrimRight, restoreName, A_LoopFileFullPath, 4
   FileMove,%A_LoopFileFullPath%,%restoreName%
  }
}

_________________
If i've seen further it is by standing on the shoulders of giants

my site | ~shajul | WYSIWYG BBCode Editor


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Yahoo [Bot] and 8 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group