+2

The deduplicator : Hiding duplicates (mod)

starcrouz 5 years ago updated 5 years ago 1

Hi !

Sometimes my comics exist in 2 formats : CBR or CBZ plus a PDF.

In that case, I would prefer to hide the PDF file to avoid the comic to be represented twice in my library.

I make it possibleit by coding this Javascript and adding it to the file named "themeScript.js" in a theme.

I hope this code to be self underestandable (commented :-) :

var last_book_name = ""; // Used by the de-duplicator
[...]
// START of the de-duplicator (excepted line "last_book_name...")
var book_file_format = src.slice(src.lastIndexOf(".")+1, src.lastIndexOf("?")); // CBZ, CBR and PDF or of the book : EPUB, MOBI, AZW, PDF and DJVU
var book_name = src.slice(src.lastIndexOf("/")+1,src.lastIndexOf("."));
if(book_name == last_book_name) { // 2 books have the same name (but not the same format...)
    if(book_file_format == "pdf") { // PDF format is not welcome if a CBR or CBZ file exist for the same comic
        thing.parents('.cellcontainer').hide(); // hide the duplicate book if it is in pdf
        console.log('duplicate book file hidden : ' + decodeURI(book_name) + '.pdf');
    }
}
last_book_name = book_name // memorize the book name
// END of the de-duplicator

The fact is I added my code on a particular theme already moded and itself based on the Plex theme. But It may be adapted to any other theme with some effort.

You can just download the complete moded theme here : it is the Plex theme with 2 mods : the reading indicator (by lostndessence) + the deduplicator by me

Enjoy !

My comic files (with duplicates...) : 

Image 590

My library presented by Ubooquity with the moded theme (without duplicates) :

Image 591

You can also download the theme directly from github here 

Download moded themeDownload moded Plex theme with the deduplicator and currently reading