Welcome, Guest
Try to get help from other ComicRack users

TOPIC: Comic List Export Details

Comic List Export Details 4 years 7 months ago #41494

  • sfreema1
  • sfreema1's Avatar
  • Offline
  • Junior Boarder
  • Posts: 21
  • Karma: 0
Hello All,

I completely caused my own situation and I want to solve it myself. I have searched the forums but haven't found exactly what I was looking for. I have a vast collection of comics. In the beginning I totally screwed up with the naming convention and relied too much on automation. This is completely my fault. I am desperately trying to filter out all the duplicates and get this beast in check. After several moths of consideration and failed attempts, I've resigned that I have to do this manually (we are talking about nearly 90,000 files, of which between 10,000 and 15,000 are duplicates). I have used the show duplicates feature, which is great. I exported to a csv, but the file itself does not contain the info I really need which is directory (I'm using Windows 8.1) and file size and name. Is there a way to get this information in the csv? I have experience with MySQL, so if I need to run that route, I'm not afraid. Any help would be appreciated. Again, I got myself into this mess, and I want to get myself out. I just need a little community help. After I get this all sorted I will post a detailed message to help out any others found in this situation in the future.

Thanks very much!

Stu
Last Edit: 4 years 7 months ago by sfreema1. Reason: Spelling
The administrator has disabled public write access.

Comic List Export Details 4 years 6 months ago #41596

  • boshuda
  • boshuda's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 335
  • Thank you received: 116
  • Karma: 10
sfreema1 wrote:
Hello All,

I completely caused my own situation and I want to solve it myself. I have searched the forums but haven't found exactly what I was looking for. I have a vast collection of comics. In the beginning I totally screwed up with the naming convention and relied too much on automation. This is completely my fault. I am desperately trying to filter out all the duplicates and get this beast in check. After several moths of consideration and failed attempts, I've resigned that I have to do this manually (we are talking about nearly 90,000 files, of which between 10,000 and 15,000 are duplicates). I have used the show duplicates feature, which is great. I exported to a csv, but the file itself does not contain the info I really need which is directory (I'm using Windows 8.1) and file size and name. Is there a way to get this information in the csv? I have experience with MySQL, so if I need to run that route, I'm not afraid. Any help would be appreciated. Again, I got myself into this mess, and I want to get myself out. I just need a little community help. After I get this all sorted I will post a detailed message to help out any others found in this situation in the future.

Thanks very much!

Stu

Stu,
I whipped up a modification of the Export Book List script.

I haven't tested this terribly well, but it did work. I'm not exactly sure what it will do if you have one of the fields it wants missing. When I wiped out the 'year' in my test files, it used -1. When I wiped out title it was a blank space (like I wanted). I decided not to do anything about the -1 since that could potentially be a valid value.

Make sure the document isn't open in Excel before attempting to run the script on it. Nothing will blow up, but it won't be able to write to the file and will fail.

If it's requested enough it should be relatively trivial to break this out into a proper script that could have user-defined columns and headings. However, I will probably never actually get around to doing that. If someone else wants to give it a go I fully support that.

Import the results into Excel and split by ';' rather than ','.

I had an issue in Excel when opening the document. Excel is separating on commas automatically, so anywhere a comma exists it was splitting that value. When I used text to columns Excel asked to overwrite existing data and selecting yes was wiping out data based on that split. This is a user-issue with Excel and people more comfortable with Excel probably know better ways to import the data to separate only on other delimiters (like ';'). I remember Excel having an import option that allowed CSV to be opened while specifying the delimiter.

Just append the following to the bottom of your OtherScripts.py and restart ComicRack. That should then enable you to right click on the books and select Automation->sfreema1 Export Book List and it will work as you expect with some additional fields, including the full directory path with filename and the filesize. OtherScripts.py is probably at C:\Program Files\ComicRack\Scripts\OtherScripts.py. Python cares about indenting, so if this gives you issues make sure to double-check that (I used spaces instead of tabs).
#
# Saves a CSV list of all the passed comics to a selectable file
#
#@Name	sfreema1 Export Book List...
#@Hook	Books, Library
#@Description Simple script to export all selected Books into a CSV file customized for sfreema1 on forum
def sfreema1SaveCSVList(books):
    name = GetFileName("Book List")
    if name=="":
        return
    from System.IO import Directory, Path
    import clr
    clr.AddReference("System.Windows.Forms")
    clr.AddReference("System.Drawing")
    
    try:
        with open(name, 'w') as f:
            f.write("Series;Title;Number;Volume;Year;Absolute File Path & Name;File Path;File Name;File Size\n")
            for book in books:
                print "------------"
                print "Processing " + book.FileName + ":"
                print Path.GetDirectoryName(book.FilePath) + "\\" + Path.GetFileName(book.FilePath)
                fields = [book.ShadowSeries,book.ShadowTitle,book.ShadowNumber,str(book.ShadowVolume),str(book.ShadowYear),book.FilePath,Path.GetDirectoryName(book.FilePath),Path.GetFileName(book.FilePath),str(book.FileSize)]
                for field in fields:
                    if not field:
                        f.write( " ;")
                        print "NULL"
                    else:
                        print field
                        f.write(field)
                        f.write(';')
                f.write("\n")
            f.close()
    except IOError as (errno, strerror):
        print "I/O Error({0}): {1}".format(errno, strerror)
        MessageBox.Show(strerror, "I/O Error({0})".format(errno))
    except:
        print "Unexpected error:", sys.exc_info()[0]
        raise
The administrator has disabled public write access.

Comic List Export Details 4 years 6 months ago #41597

  • sfreema1
  • sfreema1's Avatar
  • Offline
  • Junior Boarder
  • Posts: 21
  • Karma: 0
Thank you so much for taking time out to do this! I will test it as soon as I get home from work.

Thanks again!

Stu
The administrator has disabled public write access.

Comic List Export Details 4 years 6 months ago #41598

  • boshuda
  • boshuda's Avatar
  • Offline
  • Platinum Boarder
  • Posts: 335
  • Thank you received: 116
  • Karma: 10
Yeah, no worries. I want to write some more advanced scripts so this helps get my feet wet. Feel free to post on here if you have problems. I'm subscribed so I'll get notified straight away.
The administrator has disabled public write access.

Comic List Export Details 4 years 6 months ago #41621

  • sfreema1
  • sfreema1's Avatar
  • Offline
  • Junior Boarder
  • Posts: 21
  • Karma: 0
Hi Boshuda,

Again, my sincere thanks for whipping this up. Sorry for the delay in testing; life stuff. I believe it is working the way you intended it to. There were no errors. Any blank fields resulted in a -1. Now I just have to figure out a nice programmatic way to weed out and move the duplicates. Again, thank you so much for your effort!!!

Stu
The administrator has disabled public write access.

Comic List Export Details 6 months 2 weeks ago #62500

  • iridius
  • iridius's Avatar
  • Offline
  • Fresh Boarder
  • Posts: 3
  • Karma: 0
Thanks, I know this is 4 years old, but I just wanted to let you know that this saved me too. I had about 200 damaged Comics in my library, I wanted to remove them, because everytime they came up on a search or smart list they caused ComicRack to slow down or freeze up for up to a few minutes sometimes. Plus, what's the point of keeping them if they don't open anyway. But what I wanted before removing them was to have a list of the folders from which they came, in case I can find a working copy in my backups (maybe with the years of moving things between harddrives and computers the files got corrupted) or maybe I can download them from somewhere, but the folder names would tell me where to start my search.

So, being able to select the damaged files and export the list to CSV while including the full path worked perfectly.

To help with the Excel automatically importing and separating some of the rows and leaving others and screwing up the CSV import, I usually open the CSV file in notepad first and then past to Excel, this usually solves the issue which has occurred with other projects for me over the years when I just try to open it in Excel first. Then I went thru the Excel feature of Text to Columns and used Semicolon as the delimiter. The only caveat I encountered this time was a file that had 2 Storyline titles in it's metadata that were separated by a semicolon, because that is what the script is set to use instead of Commas (as is common with Comma Separated Value files, but with Comics I can see why Semicolons are a better choice due to being less common). I simply edited that row in Excel manually.
The administrator has disabled public write access.
Time to create page: 0.223 seconds

Who's Online

We have 104 guests and one member online