DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Folder Sorter by IMDB genre / ratings  (Read 11,009 times)

trxtrx

  • Participant
  • Joined in 2016
  • *
  • Posts: 4
Folder Sorter by IMDB genre / ratings
« on: December 11, 2016, 12:38 AM »
Hello,

first of all, hello to all of you!

i am here because i am in need of some tools to help me out in my sorting things...

I need to sort several movies folder names by genre.

the name of the folders are like this.

Jeremy.Clarkson.Thriller.DVDRip.XviD-HAGGiS

so, the app should read the folder name, identify the movie name Jeremy Clarkson Thriller and move or create a symbolic link into a Sorted/Genre folder.

Not sure if i was explicit, feel free to ask.

i may need to add other options into the application.

Feel free to email me or pm me. I am willing to pay for this :)

thank you

skrommel

  • Fastest code in the west
  • Developer
  • Joined in 2005
  • ***
  • Posts: 933
    • Participated in NANY Challenge Twice
    • Coding Snacks
Re: Folder Sorter by IMDB genre / ratings
« Reply #1 on: July 08, 2017, 09:42 AM »
SortMoviesByGenre creates links to movies, placing them in folders of genre, based on parts of their filename. :)

SortMoviesByGenre.jpg

I'm not sure how standardized your foldernames are. I added an option to separate the title and genre from the rest of the folder name by a user defines text, but maybe separating by genre would be better? I could add all the IMDB genres to the file, and use that to split the folder names.

Download and install AutoHotkey to run the script.
Save the script to a text file called SortMoviesByGenre.ahk and double click to run.

Skrommel

Code: ( autohotkey)
;SortMoviesByGenre.ahk
; Create links to movies, placing them in folders of genre, based on parts of their filename
;Skrommel @2017

#SingleInstance,Force
#NoEnv
SetBatchLines,0

IniRead,moviefolder,SortMoviesByGenre.ini,Settings,moviefolder
IniRead,sortedfolder,SortMoviesByGenre.ini,Settings,sortedfolder
IniRead,separator,SortMoviesByGenre.ini,Settings,separator
If moviefolder=ERROR
  moviefolder=C:\Movies
If sortedfolder=ERROR
  sortedfolder=C:\Sorted
If separator=ERROR
  separator=.DVD,.CAM,.XVID

Gui,Add,Text,xm,Folder with movies
Gui,Add,Edit,xm w300 vmoviefolder,% moviefolder
Gui,Add,Button,x+5 w50 GBROWSEMOVIE,&Browse
Gui,Add,Text,xm,Folder to put links sorted by genre into
Gui,Add,Edit,xm w300 vsortedfolder,% sortedfolder
Gui,Add,Button,x+5 w50 GBROWSESORTED,B&rowse
Gui,Add,Text,xm,Text separating title and genre from the rest of the name.`nUse , between separators
Gui,Add,Edit,xm w300 vseparator,% separator
Gui,Add,Button,xm w50 GSORT +Default,&Sort
Gui,Add,StatusBar,,Skrommel @ 2017
Gui,Show,,SortMoviesByGenre
Return


BROWSEMOVIE:
Loop
{
  FileSelectFolder,newmoviefolder,% "*" moviefolder,3,Select folder with movies
  If ErrorLevel=1
    Return
  IfExist,% newmoviefolder
    Break
  MsgBox,% "The movie folder could not be found!"
}
GuiControl,,moviefolder,% newmoviefolder
Return


BROWSESORTED:
Loop
{
  FileSelectFolder,newsortedfolder,% "*" sortedfolder,3,Select folder with movies
  If ErrorLevel=1
    Return
  IfExist,% newsortedfolder
    Break
  MsgBox,% "The sorted folder could not be found!"
}
GuiControl,,sortedfolder,% newsortedfolder
Return


SORT:
Gui,Submit,NoHide
IfNotExist,% moviefolder
{
  MsgBox,% "The movie folder could not be found!"
  Return
}

IniWrite,% moviefolder,SortMoviesByGenre.ini,Settings,moviefolder
IniWrite,% sortedfolder,SortMoviesByGenre.ini,Settings,sortedfolder
IniWrite,% separator,SortMoviesByGenre.ini,Settings,separator

SB_SetText("Sorting moivies into " sortedfolder "...")
Loop,% moviefolder "\*.*",2,0
{
  first=999                                           ;Extract title and genre
  Loop,Parse,separator,`,
  {
    StringGetPos,pos,A_LoopFileName,% A_LoopField
    If (pos>0 And pos<first)
      first:=pos
  }
  StringLeft,titlegenre,A_LoopFileName,% first

  StringSplit,part_,titlegenre,`.                     ;Extract genre
  genre:=part_%part_0%
  
  title=                                              ;Extract title
  Loop,% part_0-1
    title:=title part_%A_Index% " "
  title=% title

  FileCreateDir,% sortedfolder "\" genre                ;Create link
  FileCreateShortcut,% A_LoopFileLongPath,% sortedfolder "\" genre "\" title ".lnk"
}
SB_SetText("Finished sorting movies into " sortedfolder)
Return


GuiClose:
ExitApp
« Last Edit: July 17, 2017, 10:01 PM by skrommel »

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Folder Sorter by IMDB genre / ratings
« Reply #2 on: July 08, 2017, 10:04 AM »
Wait.. what just happened?  :huh:

IainB

  • @Slartibartfarst
  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,544
Re: Folder Sorter by IMDB genre / ratings
« Reply #3 on: July 08, 2017, 10:57 AM »
Maybe @skrommel responded to the OP through a wormhole in the space-time continuum, or som'at.
It's a funny old world.

tomos

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 11,970
    • Gathering Badge
    • Participated in NANY Challenge Once
Re: Folder Sorter by IMDB genre / ratings
« Reply #4 on: July 08, 2017, 12:07 PM »
;D
Tom

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Folder Sorter by IMDB genre / ratings
« Reply #5 on: July 08, 2017, 03:59 PM »
This is the moment we've been training all these years for... All DC members who have been certified in level 4 skrommel containment please report to your nearest space-time gate! Suit up and prepare for operation SKROMMEL CAPTURE.
1390.gif

wraith808

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 11,205
    • Participated in NANY Challenge Fourteen Times
    • Coding Snacks
    • Writer
    • Hardware Hacker
Re: Folder Sorter by IMDB genre / ratings
« Reply #6 on: July 08, 2017, 04:48 PM »
^ That's cute!

Deozaan

  • Charter Member
  • Joined in 2006
  • ***
  • Posts: 9,827
    • Participated in NANY Challenge Eight Times
    • Cody Award
Re: Folder Sorter by IMDB genre / ratings
« Reply #7 on: July 08, 2017, 05:48 PM »
The legend returns!

Welcome back Skrommel! We hope you'll stick around a while. :Thmbsup:

techidave

  • Supporting Member
  • Joined in 2007
  • **
  • Posts: 1,046
Re: Folder Sorter by IMDB genre / ratings
« Reply #8 on: July 09, 2017, 12:07 PM »
its back Skrommel!

Original address: https://www.donationcoder.com/forum/index.php?topic=43269.0