Welcome, Guest
Python Scripts for ComicRack

TOPIC: malor89's Perl Scripts

Re: malor89's Perl Scripts 6 years 10 months ago #11055

  • Gaijin
  • Gaijin's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 6
  • Thank you received: 2
  • Karma: 0
Sorry to jump in so late in the conversation, but I've been using your scripts for a few days and updating as this discussion continued. THANK YOU for these. They were just what I needed for a messy unsorted folder of scanlations not on comicvine.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 6 years 10 months ago #11056

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
testarchives.pl
- Tests all the archives of the matching file types in the current directory and subdirectories.
- The results are saved in a text file named "corrupt.txt".
- If there is a directory named "corrupt" in the current directory, archives with errors will be moved to it.

Note: 7-Zip must be installed for this script to work.
The path to 7z.exe can be set in the script if the default isn't correct.
The script is initially set to only check cbz, cbr, and cb7, but it would work equally well on standard zip, rar or whatever other archive types 7-Zip supports.

update: After making the original post, I realized that it would have the same problems with system directories that an ealier script had, so I've updated it with the same changes.
Attachments:
Last Edit: 6 years 10 months ago by malor89.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 6 years 10 months ago #11058

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
Gaijin wrote:
Sorry to jump in so late in the conversation, but I've been using your scripts for a few days and updating as this discussion continued. THANK YOU for these. They were just what I needed for a messy unsorted folder of scanlations not on comicvine.
I'm glad you've found them useful. I'm always happy to hear from people.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 6 years 10 months ago #11062

  • perezmu
  • perezmu's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 1112
  • Thank you received: 64
  • Karma: 51
malor89 wrote:
testarchives.pl
- Tests all the archives of the matching file types in the current directory and subdirectories.
- The results are saved in a text file named "corrupt.txt".
- If there is a directory named "corrupt" in the current directory, archives with errors will be moved to it.

So many thanks for this!
The administrator has disabled public write access.

Re: malor89's Perl Scripts 6 years 10 months ago #11082

  • 600WPMPO
  • 600WPMPO's Avatar
  • Offline
  • Moderator
  • Posts: 3788
  • Thank you received: 557
  • Karma: 232
Thanks malor89 for the testarchives.pl script..

works fine and does what it promises.. :-)
Now Playing: The ComicRack Manual (Online)

See my new comics & gadgets on: Tumblr!
The administrator has disabled public write access.

Re: malor89's Perl Scripts 6 years 10 months ago #11086

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
perezmu wrote:
So many thanks for this!
600WPMPO wrote:
Thanks malor89 for the testarchives.pl script..

works fine and does what it promises.. :-)
Glad you like it.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 6 years 10 months ago #11091

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
setmodified.pl
Sets the modified date of an archive based on the date of the newest image file it contains
- can delete non-image files from archive
- checks if cbr is cbz or vice versa
- can attempt to restore the file name of an archive from the folder name stored in the archive
- can test archives for errors
- checks if cbr or cbz contains other archives, renames them back to rar or zip if they do.
- has a fastmode option which causes the script to skip files that already have a file modified date earlier than the file creation date.

I use this script for all my new files. It started out simply as a way to tell how old the archive was and to give a way to sort files chronologically in Explorer when files were named inconsistently. I then added deleting unnecessary files (thumb.db, html, txt, nfo, etc.), since I was already working with the archives list of files. Later I noticed that archives with a truncated name sometimes contained a folder with the full original name, so I added a way to recover the full name. While getting this script ready to share, I realized if I tested the archives for errors at the same time, not only would it save a step, but also save time since the archive should already be cached in the computer's memory.

Note: By default, the script is only set to test archives and the modified date. Use Notepad to edit the script's setting at the beginning of the file. 7-Zip must be installed for this script to work. The path to 7z.exe can be set in the script if the default isn't correct. In order to delete files from rar or cbr files, WinRar must also be installed and the path set correctly in the script.
Attachments:
Last Edit: 6 years 10 months ago by malor89.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 6 years 10 months ago #11094

  • 600WPMPO
  • 600WPMPO's Avatar
  • Offline
  • Moderator
  • Posts: 3788
  • Thank you received: 557
  • Karma: 232
:) Simply superb.. malor's karma flourishes !!
malor89 wrote:
- can delete non-image files from archive
i hope it does not delete the much coveted ComicInfo.xml file..

also, while removing thumbs.db files, it is giving a 'system cannot found the path specified' error :



malor89 wrote:
$restoretags = 1; #if the archive didn't appear to have a directory with the original name, see if the file names have any additional data
while all this is very clearly written, i could not understand this restoretags function..
if you could please explain with an example..:unsure:
Now Playing: The ComicRack Manual (Online)

See my new comics & gadgets on: Tumblr!
The administrator has disabled public write access.

Re: malor89's Perl Scripts 6 years 10 months ago #11096

  • malor89
  • malor89's Avatar
  • Offline
  • Senior Boarder
  • Posts: 73
  • Thank you received: 16
  • Karma: 17
Personally, I delete the ComicInfo.xml file as well, but I made sure to add xml to the list of file types it won't delete from archives. So, ComicInfo.xml should be safe, but you can always leave prompting on if you're worried about such things. I can't remember for sure, but I think ComicRack messing up the modified dates of my files when it added ComicInfo.xml to them, may have been behind the creation of this script. I have since turned off that feature of ComicRack.

The script uses WinRar to delete files from cbr/rar files, since 7-zip can't do it. 'system cannot find the path specified' indicates that the path for rar.exe set in the script isn't working for you.

If restoretags is turned on, then if the archive name doesn't include tags in ()'s and there isn't a folder with tags in ()'s in the archive, then the script looks for repeated tags in ()'s in the names of the image files stored in the archive. If it finds any, the found tag is appended to the end of the archive name. Usually the most it finds is the scanner tag. I'm guessing most people won't use this, but it's there for people who like to know such things.

However, I really like restorefilename which is sometimes able to take an archive like "fatman #2" and restore it's name to "Fatman 2 (of 4)(2010)(Ribbon-DCP)"
Last Edit: 6 years 10 months ago by malor89.
The administrator has disabled public write access.

Re: malor89's Perl Scripts 6 years 10 months ago #11101

  • 600WPMPO
  • 600WPMPO's Avatar
  • Offline
  • Moderator
  • Posts: 3788
  • Thank you received: 557
  • Karma: 232
malor89 wrote:
The script uses WinRar to delete files from cbr/rar files, since 7-zip can't do it. 'system cannot find the path specified' indicates that the path for rar.exe set in the script isn't working for you.
Ok..i got it.. thanks for that ! :)


malor89 wrote:
If restoretags is turned on, then if the archive name doesn't include tags in ()'s and there isn't a folder with tags in ()'s in the archive, then the script looks for repeated tags in ()'s in the names of the image files stored in the archive. If it finds any, the found tag is appended to the end of the archive name. Usually the most it finds is the scanner tag. I'm guessing most people won't use this, but it's there for people who like to know such things.
B) yes.. that makes it very clear.. Basically, it is one step forward from the excellent restorefilename script.. when it doesn't see any folder inside, it looks at the filenames

I was thinking of requesting you for a perl script that does the reverse of what restoretags & restorefilename do..

Many a times, we have the archived files named simply.. scan001.jpg, scan002.jpg..., or P0001.jpg, P0002.jpg.., or Page_00001.jpg, Page_00002.jpg. Extracting a page (without using ComicRack) from such an archive leaves no meaningful information in its filename. So, if suppose the archive name can be appended to the individual jpgs inside, extracted files would say a lot about their sources..

e.g. P0001.jpg would be Infinite Crisis 01 (2005) (RIP_ODB-DCP) P0001.jpg

This could also come in handy when you wish to manually compare 2 copies of a page from 2 different scanners.

I don't know if you would consider making this script, cause I feel that you like to maintain the sanctity of the files in the way the scanner has compiled them..:unsure: Still, the script may be useful for people who need this function..
Now Playing: The ComicRack Manual (Online)

See my new comics & gadgets on: Tumblr!
Last Edit: 6 years 10 months ago by 600WPMPO.
The administrator has disabled public write access.
Time to create page: 0.265 seconds

Who's Online

We have 180 guests and 7 members online