Wanted List Backup and Restore

So you made CouchPotato even more awsome?
User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

Wanted List Backup and Restore

Postby clinton.hall » 24 Jun 2014 06:55

Hi All.

If your database gets corrupt, you are often left needing to rebuild... No big deal for the manage list, but the wanted list can be lost :(

What I have done is create a simple python script
CP_Wanted2.zip
Wanted list backup and restore tool V2
(1.4 KiB) Downloaded 2102 times
that will backup your wanted list to a simple text document.
You can run this whenever you want (your could even make it a recurring cron job).

Now hosted on GitHub https://github.com/clinton-hall/CP-BackupTool

OLDER VERSIONS ARE BELOW.

Old version:
CP_Wanted.zip
Wanted list backup and restore tool
(1.4 KiB) Downloaded 1158 times


After downloading and extracting the attached zip, you need to edit the couch.cfg to add your correct host, path and apikey (from CouchPotato, settings, general)
Make sure the script is executable, and then run it, passing in the options "backup" and the full path/name of the backup file you want to create

Code: Select all

chmod +x wanted.py
./wanted.py backup /volume1/Public/backup.txt


Now, should your database need to be deleted, or is otherwise lost, set up the quality profiles, do a full manage scan (to make sure we don't add and snatch movies that were already downloaded since your last backup) and then run this script with the option "restore" followed by the path to the backup file.
(NOTE: If you did a complete re-install, you will need to enter the NEW api key in the couch.cfg)

Code: Select all

./wanted.py restore /volume1/Public/backup.txt


This doesn't assign a specific quality or category... you will need to manually edit these in the wanted list.
In case you are worries about auto-snatch with the wrong quality etc (not default) I suggest setting your downloader to "manual" to prevent auto-snatching, before running the restore. Take the downloader out of "manual" mode once you are comfortable all has been restored correctly.

ugo
Member
Posts: 106
Joined: 27 Jul 2012 01:56
Has thanked: 2 times
Been thanked: 2 times
Contact:
Status: Offline

Re: Wanted List Backup and Restore

Postby ugo » 24 Jun 2014 08:44

Thanks so much.

spammy
Junior Member
Posts: 9
Joined: 17 Jun 2012 17:55
Been thanked: 2 times
Contact:
Status: Offline

Re: Wanted List Backup and Restore

Postby spammy » 24 Jun 2014 22:11

Thank you for this!

clinton.hall wrote:This doesn't assign a specific quality or category... you will need to manually edit these in the wanted list.
In case you are worries about auto-snatch with the wrong quality etc (not default) I suggest setting your downloader to "manual" to prevent auto-snatching, before running the restore. Take the downloader out of "manual" mode once you are comfortable all has been restored correctly.


Just to be clear, does this imply that all will be added with the default quality ("best" for me)?

Is there a way to erase the database without losing the config? Do I just remove a db file or something?

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

Re: Wanted List Backup and Restore

Postby clinton.hall » 25 Jun 2014 00:56

Yes, I believe it adds all movies with the default profile (and either the default category, or none... I'm not certain on that)

To remove the database, just shutdown CP, go into the data_dir (see settings, about for a list of the directories... The first is the application directory and the second is the data directory) and delete the database folder.

All settings are in the settings.conf, so as long as you don't delete that file, these will remain. Note that the Profiles are stored in the database and not the settings, so the profiles will need to be rebuilt after deleting the database.

spammy
Junior Member
Posts: 9
Joined: 17 Jun 2012 17:55
Been thanked: 2 times
Contact:
Status: Offline

Re: Wanted List Backup and Restore

Postby spammy » 25 Jun 2014 22:01

This worked perfectly - all movies were added with "best" quality.

kenr276
Junior Member
Posts: 26
Joined: 16 Feb 2014 17:31
Has thanked: 7 times
Status: Offline

Re: Wanted List Backup and Restore

Postby kenr276 » 06 Jul 2014 20:22

Help

Sorry for the dumb questions but here there are:

Where do I extract the zip file to?

What (where) is script and how do I make it executable?

How do I pass in the options "backup" and the full path/name of the backup and where do I find the path/name?

Thanks for any help.

BTW: On a Win7 PC

spammy
Junior Member
Posts: 9
Joined: 17 Jun 2012 17:55
Been thanked: 2 times
Contact:
Status: Offline

Re: Wanted List Backup and Restore

Postby spammy » 06 Jul 2014 21:00

kenr276 wrote:Help

Sorry for the dumb questions but here there are:

Where do I extract the zip file to?

What (where) is script and how do I make it executable?

How do I pass in the options "backup" and the full path/name of the backup and where do I find the path/name?

Thanks for any help.

BTW: On a Win7 PC


This zip contains a standalone Python application that needs Python installed to run. I ran it on Windows with Python 2.7, so go to the Python website and install that first.

You can then extract the zip anywhere, run it with the Python you installed.

"backup" is an option you pass on the command line. The path and name can be whatever you want, that's where the file will be saved.

Good luck!

kenr276
Junior Member
Posts: 26
Joined: 16 Feb 2014 17:31
Has thanked: 7 times
Status: Offline

Re: Wanted List Backup and Restore

Postby kenr276 » 06 Jul 2014 21:40

Thanks for the help. I have python installed but know nothing about it and need some clarification.
How do I run it with python and what is it?

What exactly do I type in the command line?

Is the path and name something like this "C:\Users\Kenneth\Documents\Wanted Backup List\wanted backup.txt"?

spammy
Junior Member
Posts: 9
Joined: 17 Jun 2012 17:55
Been thanked: 2 times
Contact:
Status: Offline

Re: Wanted List Backup and Restore

Postby spammy » 06 Jul 2014 21:55

It depends on your system but it would be something like this:

c:\python27\python.exe c:\path_to_unzipped\wanted.py backup "C:\Users\Kenneth\Documents\Wanted Backup List\wanted backup.txt"

Make sure you have configured the config file too!

kenr276
Junior Member
Posts: 26
Joined: 16 Feb 2014 17:31
Has thanked: 7 times
Status: Offline

Re: Wanted List Backup and Restore

Postby kenr276 » 06 Jul 2014 22:03

Thanks again. Can I unzip into "C:\Users\Kenneth\Documents\Wanted Backup List\"?

The CFG file can be changed to this:

[CouchPotato]
host = localhost
port = 5050
apikey = 44602ed6bd964709b493b8b6e280cd27
ssl = 0
web_root =

Changing only apikey would it work and copying & pasting in the command line c:\python27\python.exe C:\Users\Kenneth\Documents\Wanted Backup List\CP_Wanted_List\wanted.py backup "C:\Users\Kenneth\Documents\Wanted Backup List\wanted backup.txt" with the quotes?

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

Re: Wanted List Backup and Restore

Postby clinton.hall » 06 Jul 2014 23:20

Yes to all... In command prompt you need quotes around all paths that have spaces... So enter the following exactly

Code: Select all

c:\python27\python.exe "C:\Users\Kenneth\Documents\Wanted Backup List\CP_Wanted_List\wanted.py" backup "C:\Users\Kenneth\Documents\Wanted Backup List\wanted backup.txt"

kenr276
Junior Member
Posts: 26
Joined: 16 Feb 2014 17:31
Has thanked: 7 times
Status: Offline

Re: Wanted List Backup and Restore

Postby kenr276 » 07 Jul 2014 17:05

Thank you clinton.hall it worked.
Thank you spammy for your help.

Sorry for being such a pest.

sacretagent
Junior Member
Posts: 12
Joined: 16 May 2012 03:39
Contact:
Status: Offline

Re: Wanted List Backup and Restore

Postby sacretagent » 11 Jul 2014 05:35

worked perfect ... my database needed a cleanup... been working with the same one for ages ...
this made it easy to restore my wanted list :)

Troberg
Junior Member
Posts: 10
Joined: 14 Jul 2014 15:55
Been thanked: 2 times
Status: Offline

Re: Wanted List Backup and Restore

Postby Troberg » 20 Jul 2014 15:55

I get (the caret is pointing at the comma):

"File "D:\dl\CP_Wanted_List\wanted.py", line 14
print "Loading config from", configFilename
^
SyntaxError: invalid syntax"

What am I doing wrong???

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

Re: Wanted List Backup and Restore

Postby clinton.hall » 20 Jul 2014 23:38

Did you edit this file at all, or just extract? What did you use to extract the files?

Troberg
Junior Member
Posts: 10
Joined: 14 Jul 2014 15:55
Been thanked: 2 times
Status: Offline

Re: Wanted List Backup and Restore

Postby Troberg » 21 Jul 2014 08:36

I simply extracted it, using 7zip. It's a correct text file, nothing wrong with the format (it wouldn't have run the first 13 lines otherwise). Didn't edit it, except for the API key in the config file.

I'm running Python 3.4, is that a problem? For it to fail on such a simple line, I suspect some kind of fundamental environment issue, but I've never worked much with Python, so I don't know.

User avatar
clinton.hall
Moderator
Posts: 9224
Joined: 28 Jun 2012 12:55
Has thanked: 94 times
Been thanked: 465 times
Contact:
Status: Offline

Re: Wanted List Backup and Restore

Postby clinton.hall » 21 Jul 2014 13:30

this required python2.7

Troberg
Junior Member
Posts: 10
Joined: 14 Jul 2014 15:55
Been thanked: 2 times
Status: Offline

Re: Wanted List Backup and Restore

Postby Troberg » 21 Jul 2014 13:41

Nice, seems to work better now (although it will take a couple of hours to add them all...)!

Now, I'll just have to go find a helmet, so the rest of the family won't kill me for choking our internet connection...

By the way, if there's someone who wants my program for going from a list of titles to IMDB ID, drop me a note. I'll need to put some more polish on it first, though...

jaxjexjox
Member
Posts: 62
Joined: 22 Jul 2014 12:09
Status: Offline

Re: Wanted List Backup and Restore

Postby jaxjexjox » 26 Jul 2014 01:51

Hey thanks heaps for this, I umm actually got it working! 74 movies imported. Would prefer CP could somehow backup my whole history and if I've rejected a release or not but hell, this will do for sure.

Appreciate it :heart:

rveex
Junior Member
Posts: 5
Joined: 25 Jul 2014 23:15
Has thanked: 1 time
Status: Offline

Re: Wanted List Backup and Restore

Postby rveex » 08 Aug 2014 10:03

EDIT: Now working had not ran elevated command.

Thanks for tool

I am trying to run the application but get the following error.

Code: Select all

    result = json.load(urlObj)
  File "c:\python27\lib\json\__init__.py", line 290, in load
    **kw)
  File "c:\python27\lib\json\__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "c:\python27\lib\json\decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "c:\python27\lib\json\decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded


Return to “External Tools”