Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

xkcd-fetch stores alt-text both in transcript and in title-text fields #13

Closed
lramati opened this issue May 24, 2012 · 3 comments
Closed

Comments

@lramati
Copy link

lramati commented May 24, 2012

I ran "xkcd-fetch -a" off a fresh dl of trsp. I pressed [return] after it output "Downloading comic 1059" (the latest one when I wrote this) and moved to a new line. I got this:

Traceback (most recent call last):
File "/home/lior/TRSP/bin/xkcd-fetch", line 273, in
comic_list.append(fetch(comics, int(line)))
ValueError: invalid literal for int() with base 10: ''

and RED_SPIDER_ROOT/work/xkcd-fetch/comic-data.txt was empty

it is also worth noting that the alt-text appears in the transcript of each comic and isnt filtered when put in the file, so that it appears at the end of the transcript data field and also in the title-text data field.

@jgonggrijp
Copy link
Member

The behaviour of xkcd-fetch -a that you describe is expected, strange as it may seem. Unless you specify the -n or -r option, xkcd-fetch expects that the user enters a comic number, either as an argument or on standard input. When you pressed return it expected a number and since the program is still a bit brittle with regard to unexpected circumstances, it crashed. What you wanted here was really xkcd-fetch -a -n or perhaps even xkcd-fetch -a -n -q. See xkcd-fetch -h for an overview of the options.

As for your other issue, that's probably not intended behaviour. I'm changing the issue title to emphasize this.

@nforrester Please have a look at this when you find the time?

@lramati
Copy link
Author

lramati commented May 29, 2012

Another note on the alt-text issue:
The alt text is always within double curly braces within the transcript string, afaict. Since Randall is inconsistent (or at least switched from one to the other at some point) about calling it the "title text" and "alt text" (and how he formats them) this looks like the best way of identifying it. However, some of the very early comics (like #10) don't have this addendum to the transcript, and others don't have a transcript (like 1060) so the program shouldn't take them for granted.

@jgonggrijp
Copy link
Member

I just reviewed this issue by reading the feed cache, and I think it is actually fine as it is. The title_text field is always there, so there is no problem if you just want to know the title text. The transcript is not always there and doesn't always contain the title text in the same way, but that's an issue that only matters when you need a textual representation of the comic. The issue of completely lacking transcripts is not something we can fix, and by itself, it's fine for the title text to appear in the transcript. I think we should not worry about whether the transcript-embedded title text is called "Alt:" or "Title text:"; there is some value in staying faithful to the original JSON feed, too.

So I'm finally closing this issue. @cutecprog: if you want me to reopen it, just let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants