Welcome, Guest
Python Scripts for ComicRack

TOPIC: malor89's Perl Scripts

Re: malor89's Perl Scripts 7 years 1 week ago #10972

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
600WPMPO wrote:
So, would it be possible to modify the script so that it matches the file name with the initial alphabets of the folder ?

It is notable that the script does not read the entire file name, but picks up just the series name from it. Similarly, it should also look for the series name in the folder name. fair, isn't it ? :unsure:
Or you could just organize your comics the exact same way I do. :) But seriously, the next set of scripts I post might meet your needs. It's an idea I developed, before going back to the simpler method.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 7 years 1 week ago #10973

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
listsort.pl and makesort.pl
This is my attempt at a smart sorting script that can handle nested directories and different title stored in the same directory. It's a two part process. makesort.pl scans the comic directory recursively and makes a list of the titles it finds and where it found them. It attempts to list the first two words, skipping the's. It eliminates non-letters, so X-Person and XPerson are treated and matched the same. It creates a file called "sortlist.txt" in the main comic folder. This file can be edited with notepad to eliminate any entries that you never want used. listsort.pl can then be used to sort the comics in the directory in which it is run.

note:Both listsort.pl and makesort.pl assume that comics are sorted in a directory called "comics" at the top level. If this isn't the case the first line of both files needs to be edited. makesort.pl also has a setting to change the threshold number of matches before listing the directory in the "sortlist.txt" file. If you'd like to run listsort.pl without having it actually move the files, just add a # before rename in the .pl file.

Edit: This version is obsolete.
Last Edit: 7 years 4 days ago by malor89.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 7 years 6 days ago #10977

  • 600WPMPO
  • 600WPMPO's Avatar
  • Offline
  • Moderator
  • Posts: 3788
  • Thank you received: 557
  • Karma: 232
malor89 wrote:
Both listsort.pl and makesort.pl assume that comics are sorted in a directory called "comics" at the top level. If this isn't the case the first line of both files needs to be edited.
I keep all my comics (grouped by publishers) in the D drive.. so, i used:
$comicdir = "D:\";
but this is not working..

Edit: I managed to make it work for each individual publisher folder.

e.g. I keep the scripts in the folder:
D:\Avatar\zzUncategorised
and rename the first line to:
$comicdir = "/avatar";
It would be great if this worked from my 0 Day folder.. that would sort all files in almost one click. Here is what my comic folder structure looks like:



So, all the new unsorted files are initially in the 0 Day folder, and I then move files belonging to one publisher to a zzUncategorised folder within each individual publisher folder, and then run the scripts.

Any ideas ? :unsure:
Now Playing: The ComicRack Manual (Online)

See my new comics & gadgets on: Tumblr!
Last Edit: 7 years 6 days ago by 600WPMPO.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 7 years 6 days ago #10978

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
Just use $comicdir ="/."; and make sure you are running the scripts from the D: drive. Standard Perl doesn't understand drive letters and you need to use either "/" or "\\" for the seperator. I should put that in the note in the .pl files.

This post has been edited to fix a mistake.
Last Edit: 7 years 6 days ago by malor89.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 7 years 6 days ago #10979

  • 600WPMPO
  • 600WPMPO's Avatar
  • Offline
  • Moderator
  • Posts: 3788
  • Thank you received: 557
  • Karma: 232
malor89 wrote:
Just use $comicdir ="/"; and make sure you are running the scripts from the D: drive.
I tried that but it doesn't do anything.. just an empty(?) command prompt box flashes for a second, and disappears without making any list

What i would like to do is to run the script from within the 0 Day folder (see my post above for a screenshot) and let it sort the files into their respective folders within the various publisher folders..
Now Playing: The ComicRack Manual (Online)

See my new comics & gadgets on: Tumblr!
Last Edit: 7 years 6 days ago by 600WPMPO.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 7 years 6 days ago #10980

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
600WPMPO wrote:
malor89 wrote:
Just use $comicdir ="/"; and make sure you are running the scripts from the D: drive.
I tried that but it doesn't do anything.. just an empty(?) command prompt box flashes for a second, and disappears without making any list

What i would like to do is to run the script from within the 0 Day folder (see my post above for a screenshot) and let it sort the files into their respective folders within the various publisher folders..
I was mistaken. "/" is the root directory, but when the rest of the script attempts to access a subdirectory, it becomes "//subdirectory" which is wrong. So to get around this you need to use "/.", which works for the root directory and subdirectories. I tested this out and it works, but tries to read the system folder of "System Volume Information" and "$RECYCLE.BIN", so I had to update the scripts to prevent the script from quitting when it can't access protected directories. With any luck it should work for you now. The update is found in the scripts original location.
Last Edit: 7 years 6 days ago by malor89.
The administrator has disabled public write access.
The following user(s) said Thank You: 600WPMPO

Re: malor89's Perl Scripts 7 years 6 days ago #10981

  • 600WPMPO
  • 600WPMPO's Avatar
  • Offline
  • Moderator
  • Posts: 3788
  • Thank you received: 557
  • Karma: 232
malor89 wrote:
..you need to use "/.", which works for the root directory and subdirectories. I tested this out and it works, but tries to read the system folder of "System Volume Information" and "$RECYCLE.BIN", so I had to update the scripts to prevent the script from quitting when it can't access protected directories...
Yes.. it is working now !
more karma follows :)

However, some fine-tuning is required. Here are some lines from my comicsort.txt file:
avengers	/./Marvel/Marvel Limited Series/Avengers Invaders [12 issue mini-series 2008, complete]		
avengersinvaders	/./Marvel/Marvel Limited Series/Avengers Invaders [12 issue mini-series 2008, complete]
while i have a lot of folders that begin with the word Avengers:



and also:



Another example:
gi joe	/idw/G.I. Joe/G.I. Joe [2008, ongoing]


So, I fear that when i run the listsort.pl, it will put all the GIjoes in one folder and all the avengers in another.
How do we handle this problem ?
malor89 wrote:
makesort.pl also has a setting to change the threshold number of matches before listing the directory in the "sortlist.txt" file.
Maybe the threshold matching could help in some way ?:unsure:
Now Playing: The ComicRack Manual (Online)

See my new comics & gadgets on: Tumblr!
Last Edit: 7 years 6 days ago by 600WPMPO.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 7 years 6 days ago #10986

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
600WPMPO wrote:
Yes.. it is working now !
more karma follows :)


However, some fine-tuning is required.
Now you see why I went back to the simpler comicsort.pl which while not perfect, worked good enough for my needs. However, I've thought up a way to objectively test the code for accuracy. I can modify the scripts to work off a text file list of comics and see how accurately it can virtually sort every file back to its correct location.
Last Edit: 7 years 6 days ago by malor89.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 7 years 6 days ago #10987

  • 600WPMPO
  • 600WPMPO's Avatar
  • Offline
  • Moderator
  • Posts: 3788
  • Thank you received: 557
  • Karma: 232
malor89 wrote:
Now you see why I went back to the simpler comicsort.pl which while not perfect, worked good enough for my needs.
Yes malor89, I fully agree for you.. I've begun slightly simplifying my folder names..
from:
Freak Angels [ongoing 2008] [Webcomic]
its now simply
Freak Angels
However, I would like to keep the following folder structures intact:
D:\Marvel\Avengers\Avengers (2010)
D:\Marvel\Avengers\Avengers Academy
D:\IDW\G.I. Joe\G.I. Joe (2008)
D:\IDW\G.I. Joe\GI Joe Cobra
D:\IDW\G.I. Joe\GI Joe Cobra II
malor89 wrote:
I've thought up a way to objectively test the code for accuracy. I can modify the scripts to work off a text file list of comics and see how accurately it can virtually sort every file back to its correct location.
I am really looking forward if somehow you can post a code accurate enough for such a folder structure..:unsure:
Now Playing: The ComicRack Manual (Online)

See my new comics & gadgets on: Tumblr!
Last Edit: 7 years 6 days ago by 600WPMPO.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 7 years 5 days ago #10998

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
New version of sortlist.pl
- added an option in makelist.pl to skip processing selected directories
- added an option in listsort.pl to prompt before moving files (selected by default, just press enter to confirm or "n" then enter to skip moving)
- changed the $minmatches default to 1, since testing revealed it provides a significant accuracy improvement.
- changed the detection algorithm, it now tries to match the entire title, removing a word at a time until it finds a match.

Edit: This version is obsolete.
Last Edit: 7 years 4 days ago by malor89.
The administrator has disabled public write access.
Time to create page: 0.237 seconds

Who's Online

We have 301 guests and 5 members online