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

Archive posts #2

Open
rominf opened this issue Apr 19, 2015 · 6 comments
Open

Archive posts #2

rominf opened this issue Apr 19, 2015 · 6 comments

Comments

@rominf
Copy link
Contributor

rominf commented Apr 19, 2015

@daniilr, is there way to archive posts?

I guess, no, as I didn't find it on: http://www.livejournal.com/doc/server/ljp.csp.xml-rpc.protocol.html

That's sad. I found that http://ljcharm.livejournal.com/ is capable of doing this, but:

  1. It's written in python2.
  2. It has terrible codebase (IMHO, sorry Charm developers!). I mean: all the code is contained in one file & CLI is mixed with the logics.

What do you think?

@daniilr
Copy link
Owner

daniilr commented Apr 19, 2015

I guess, no, as I didn't find it on: http://www.livejournal.com/doc/server/ljp.csp.xml-rpc.protocol.html

This is a official XML RPC protocol of LiveJournal. Obviously it will never have archive function (if you mean "dump to disk" function). LJServer is a wrapper for this interface. BTW take a look at backup script at backup.py. I guess it should be rewritten with better option for serialization.

  1. It's written in python2.

We don't support python 3 for now. But this a great suggestion.

@rominf
Copy link
Contributor Author

rominf commented Apr 19, 2015

@daniilr
I can port it to python3. Do you mind?
I would drop python2 support, because it's legacy and it's python2-python3 code is unidiomatic.

@daniilr
Copy link
Owner

daniilr commented Apr 19, 2015

Would be great. I am working to write unittests now

@daniilr
Copy link
Owner

daniilr commented Apr 19, 2015

@rominf check out #3

@markfortma
Copy link

I don't know where else to post this - so I am putting it here:

def datetime_from_string(s):
    """This assumes input in the form '2007-11-19 12:24:01' because that's all I care about"""
    if(s):
        date_s = s.split(' ')
        print(date_s)
        year_s, month_s, day_s = date_s[0].split('-')
        hour_s, min_s, sec_s = date_s[1].split(':')
        return datetime.datetime(int(year_s), int(month_s), int(day_s), int(hour_s), int(min_s), int(sec_s))
    # Fallback: Y2K
    return datetime.datetime(2000,1,1,0,0,0,0)

I encountered NoneType often and this corrected it.

Also, keywords all and id are Python keywords, switch them to all_ and id_ or select a new variable name; they were found in many of the functions in backup.py

@daniilr
Copy link
Owner

daniilr commented Jan 5, 2016

@markfortma
Changed it to:

return datetime.datetime.strptime(s, "%Y-%m-%d %H:%M:%S")

I think strptime is the best approach here. Who needs manual parsing? :)

daniilr added a commit that referenced this issue Jan 5, 2016
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