Cannot connect to X server

View previous topic View next topic Go down

Cannot connect to X server

Post  Ackis on Sat May 03, 2014 10:01 pm

Just installed ComicTagger today on my Ubuntu headless server.

I'm trying to run it with the following command:
Code:
/usr/local/bin/comictagger.py --recursive --online --parsefilename --type=CR --dryrun --verbose /media/Comics/

However I get the error of:

Code:
comictagger.py: cannot connect to X server

Code:
 /usr/local/bin/comictagger.py --version
ComicTagger 1.1.14-beta:  Copyright (c) 2012-2014 Anthony Beville
Distributed under Apache License 2.0 (http : / / w w w.apache.org/licenses/LICENSE-2.0)

Ackis

Posts : 9
Join date : 2014-05-03

View user profile

Back to top Go down

Re: Cannot connect to X server

Post  ComicTagger on Sun May 04, 2014 12:05 am

It looks like you're not specifying an actual command, so ComicTagger is trying to start the GUI.

Maybe it's not super clear in the documentation, but when running in CLI mode, you need to specify save/delete/copy/print/rename/export. In this case, I assume you're wanting to save tags from online, so you need to specify -s (or --save).

Hope this helps!
avatar
ComicTagger
Admin

Posts : 208
Join date : 2012-12-02

View user profile http://comictagger.forumotion.com

Back to top Go down

Re: Cannot connect to X server

Post  Ackis on Sun May 04, 2014 12:07 am

Thanks! Yeah it wasn't clear, I wanted to do a dry-run to see what the program does so I had removed the save option.

Ackis

Posts : 9
Join date : 2014-05-03

View user profile

Back to top Go down

Re: Cannot connect to X server

Post  ComicTagger on Sun May 04, 2014 12:14 am

Understandable. The dry run option is good, and you can see what all will happen for each tagging. If you like the results, the good thing is most of the results are cached, if run again without the the dry run option, it won't have to hit ComicVine much.
avatar
ComicTagger
Admin

Posts : 208
Join date : 2012-12-02

View user profile http://comictagger.forumotion.com

Back to top Go down

Re: Cannot connect to X server

Post  Ackis on Sun May 04, 2014 6:09 pm

I didn't have a chance to test last night but as you said the --save option allowed it to run. Smile

Now I'm just having issues with "is not a comic archive".

Ackis

Posts : 9
Join date : 2014-05-03

View user profile

Back to top Go down

Re: Cannot connect to X server

Post  ComicTagger on Sun May 04, 2014 8:18 pm

Can you be more specific? When do you have a problem with the comics not being recognized? If it's with CBRs specifically, do you have the unrar installed and in the executable path? Typing "which unrar" should verify. If it's not there, "sudo apt-get install unrar"

avatar
ComicTagger
Admin

Posts : 208
Join date : 2012-12-02

View user profile http://comictagger.forumotion.com

Back to top Go down

Re: Cannot connect to X server

Post  Ackis on Mon May 05, 2014 9:43 am

I'm dealing with .cbz files right now.  I don't really have more information to give you because I don't see any log information other than "not a valid comic file".

This error shows up for the majority of my collection.
The comics seem to load into ComicRack without issue.
I installed the Windows version of ComicTagger to see if the issue showed up and it did.
Winrar and unrar are installed.

Edit: I opened various .cbz files with a gui unzip program. It looks like the errors I'm getting with the 'not a valid comic' appear for .cbz files that do not have a comicinfo.xml file in them.

Ackis

Posts : 9
Join date : 2014-05-03

View user profile

Back to top Go down

Re: Cannot connect to X server

Post  ComicTagger on Mon May 05, 2014 10:11 am

If you're only tagging them with ComicTagger, then yes, the only ones with a xml file are going to be the ones that CT can write to! :-) So that's probably just a symptom of the problem.

Email me one of the offending CBZ files and I'll have a look. comictagger@gmail.com

avatar
ComicTagger
Admin

Posts : 208
Join date : 2012-12-02

View user profile http://comictagger.forumotion.com

Back to top Go down

Re: Cannot connect to X server

Post  Ackis on Mon May 05, 2014 1:31 pm

Just sent you one of them. Smile

Ackis

Posts : 9
Join date : 2014-05-03

View user profile

Back to top Go down

Re: Cannot connect to X server

Post  ComicTagger on Mon May 05, 2014 1:55 pm

This archive you sent has "webp" images in it, which ComicTagger doesn't know how to read. I had a suspicion this might be the case, and this is the first time I've come across these.

I honestly don't have a clue how much work it will be to add support, but I'll look into it this week.
avatar
ComicTagger
Admin

Posts : 208
Join date : 2012-12-02

View user profile http://comictagger.forumotion.com

Back to top Go down

Re: Cannot connect to X server

Post  ComicTagger on Mon May 05, 2014 2:08 pm

What's even more interesting, is that even though the files are named with a ".webp" extension, they are actually JPEG images.

So, in theory ComicTagger should be able to read them, but it's rejecting them based on the filename extension. I'll have to look through the code to see how to fix this, in addition to actual WebP support.

I'm curious, what utility did you run your comic files through that renamed the images to "webp" , but didn't actually convert them from JPEG format? Or did you acquire them that way?
avatar
ComicTagger
Admin

Posts : 208
Join date : 2012-12-02

View user profile http://comictagger.forumotion.com

Back to top Go down

Re: Cannot connect to X server

Post  Ackis on Mon May 05, 2014 2:25 pm

I had found a script somewhere, I don't remember off the top of my head:

Code:
#!/bin/bash
echo "Converting CBRs to CBZs and JEPG to WEBP"

# Set the "field separator" to something other than spaces/newlines" so that spaces
# in the file names don't mess things up. I'm using the pipe symbol ("|") as it is very
# unlikely to appear in a file name.
IFS="|"

# Set working directory where to create the temp dir. The user you are using must have permission
# to write into this directory.
# For performance reasons I'm using ram disk (/dev/shm/) in Ubuntu server.
WORKDIR="/dev/shm/"

# Set name for the temp dir. This directory will be created under WORDDIR
TEMPDIR="cbr2cbz"

# The script should be invoked as "cbr2cbz {directory}", where "{directory}" is the
# top-level directory to be searched. Just to be paranoid, if no directory is specified,
# then default to the current working directory ("."). Let's put the name of the
# directory into a shell variable called SOURCEDIR.
# Note: "$1" = "The first command line argument"
if test -z $1; then
        SOURCEDIR=`pwd`
else
        SOURCEDIR="$1"
fi

echo "Working from directory $SOURCEDIR"

# We need an empty directory to work in, so we'll create a temp directory here
cd $WORKDIR
mkdir $TEMPDIR
# and step into it
cd $TEMPDIR

# Now, execute a loop, based on a "find" command in the specified directory. The
# "-printf "$p|" will cause the file names to be separated by the pipe symbol, rather than
# the default newline. Note the backtics ("`") (the key above the tab key on US
# keyboards).
for CBRFILE in `find $SOURCEDIR -regex ".*\(cbr\|CBR\|cbz\|CBZ\)$" -printf "%p|"`; do

        EXTENSION=`echo ${CBRFILE##*.}`

        # Now for the actual work. First, extract the base file name (without the extension)
        # using the "basename" command. Warning: more backtics.
        BASENAME=`basename $CBRFILE ".$EXTENSION"`

        # And the directory path for that file, so we know where to put the finished ".cbz"
        # file.
        DIRNAME=`dirname $CBRFILE`

        # Now, build the "new" file name,
        NEWNAME="$BASENAME.cbz"

        # We use RAR file's name to create folder for unpacked files
        echo "Processing $CBRFILE"
        mkdir "$BASENAME"
        echo ${EXTENSION^^}
        if [ "$(echo ${EXTENSION^^})" == 'CBR' ]
                then
                # and unpack the RAR file into it
                unrar e "$CBRFILE" "$BASENAME"
        fi

        if [ "$(echo ${EXTENSION^^})" == 'CBZ' ]
                then
                # and unpack the ZIP file into it
                unzip -j "$CBRFILE" -d "$BASENAME"
        fi

        cd "$BASENAME"

        # Lets ensure the permissions allow us to pack everything
        sudo chmod 777 -R ./*

        # Lets use convert from ImageMagic package to convert JEPGs to WEBP.
        for f in *.jpg; do echo "Converting $f to WEBP"; convert "$f" -quality 80 -define webp:auto-filter=true -define webp:method=6 "$(basename "$f" .jpg).webp"; rm -f $f; done

        # Put all the extracted files into new ".cbz" file
        zip "$NEWNAME" *

        # And move it to the directory where we found the original ".cbr" file
        mv "$NEWNAME" $DIRNAME/"$NEWNAME"

        # Finally, "cd" back to the original working directory, and delete the temp directory
        # created earlier.
        cd ..
        rm -r "$BASENAME"

        # Delete the RAR file also
        if [ "$EXTENSION" != 'cbz' ]
                then
                        rm "$CBRFILE"
        fi

done

# At the end we cleanup by removing the temp folder from ram disk
cd ..
echo "Conversion Done"
rm -r $TEMPDIR

Ackis

Posts : 9
Join date : 2014-05-03

View user profile

Back to top Go down

Re: Cannot connect to X server

Post  ComicTagger on Tue May 06, 2014 11:16 am

Looks like if you don't have imagemagick built with WebP support, all that the convert command does is change the name.  The default package on the current Ubuntu doesn't have support yet.  Go to the following link to get imagemagick set up with webp support:
http://askubuntu.com/questions/251950/imagemagick-convert-cant-convert-to-webp/251954#251954

As far as ComicTagger is concerned, in the short term, you can change the the source to at least recognize the pages.  Edit comictaggerlib/comicarchive.py.  Search for the string "jpeg", and you will see the line like this:
Code:

           if ( name[-4:].lower() in [ ".jpg", "jpeg", ".png", ".gif" ] and os.path.basename(name)[0] != "." ):
You just want to add another entry to the list:  "webp"  (note there is no period)
Code:

           if ( name[-4:].lower() in [ ".jpg", "jpeg", ".png", ".gif", "webp" ] and os.path.basename(name)[0] != "." ):

This will allow CT to recognize your not-really-WebP image files.

Once you get actual WebP images, I've had some luck with Ubuntu 14.04, after I've installed various WebP libraries, the image processing seemed to work. I don't have access to that machine now, but I think I used apt-get to install webp and libwebp5.

Unfortunately WebP impementations is still a bit new, and trying to get full cross-platform support for ComicTagger maybe not be possible soon.
avatar
ComicTagger
Admin

Posts : 208
Join date : 2012-12-02

View user profile http://comictagger.forumotion.com

Back to top Go down

Re: Cannot connect to X server

Post  Ackis on Tue May 06, 2014 5:13 pm

Thanks for the response, I hadn't heard about webp... this is what I get for blindly using a script right? (Well I checked to make sure there was nothing like sudo rm -rf / Razz)

New script is here if you're interested: pastebin com Mpar9Pzk

Ackis

Posts : 9
Join date : 2014-05-03

View user profile

Back to top Go down

Re: Cannot connect to X server

Post  Ackis on Wed May 07, 2014 12:25 pm

Just wanted to say thanks for the help again.

What I ended up doing was creating a script to go through all the cbz's, extract them, check to see if the files are JPEG or something else, and if they're JPEG to rename the extension.  That ended up fixing my problems with the original script where it thought it was converting to webp but didn't actually convert.

I was then able to run ComicTagger on a few test files successfully and from there I ran it on my entire comic collection:
Code:
 /usr/local/bin/comictagger.py -s -i -o -f -R -v -t CR /media/Comics/

Everything seemed to work out fine, about 5 with low confidence matches, and about 20 with no matches at all.

Edit: Also I just noticed ComicTagger has a convert from rar function... I'm an id10t

Ackis

Posts : 9
Join date : 2014-05-03

View user profile

Back to top Go down

Re: Cannot connect to X server

Post  ComicTagger on Fri May 09, 2014 12:11 am

Awesome! Glad it worked out.

Actually, it's good, it got me moving a implementing the WebP support, event though you didn't need it :-) It should be in the next release.

So 20 non-matches out of how many? :-)
avatar
ComicTagger
Admin

Posts : 208
Join date : 2012-12-02

View user profile http://comictagger.forumotion.com

Back to top Go down

Re: Cannot connect to X server

Post  Ackis on Fri May 09, 2014 10:22 am

Hehe hundreds and hundreds.  I was actually impressed with the accuracy.  It looks like most of those unmatched are due to me having weird file names for them.

So far there have been 3 categories of comics that haven't been matched:

Metadata is wrong on comicvine
My name for the comic is off (e.g. wrong year)
And there's a third category of I don't know what's going on yet. Very Happy

Is there a way for me to get comictagger to print out which comics do not have metadata?

Ackis

Posts : 9
Join date : 2014-05-03

View user profile

Back to top Go down

Re: Cannot connect to X server

Post  Sponsored content


Sponsored content


Back to top Go down

View previous topic View next topic Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum