Python script: Channels DVR movie list -> CSV file

I have written a Python script that uses the Channels DVR API to retrieve the list of movies from the library and writes this list to a CSV file.

Here it is from my Google Drive:

Maybe later I may consider putting in GitHub but not sure if it's really worth it.

Precondition to run this script: this may be obvious but since this is a Python script, you must have Python installed on your system.

I have tested it on my computer with the following specs:

  • Windows 11 Home 10.0.22621.1265
  • Python 3.10.4

How to use this script:

PS C:\Users\mjitk\Documents\Scripts> python .\cdvr_movie_library_to_csv.py -h
usage: cdvr_movie_library_to_csv.py [-h] [-i IP_ADDRESS] [-p PORT_NUMBER] [-v]

Channels DVR movie list -> CSV file.

options:
  -h, --help            show this help message and exit
  -i IP_ADDRESS, --ip_address IP_ADDRESS
                        IP address of the Channels DVR server
  -p PORT_NUMBER, --port_number PORT_NUMBER
                        Port number of the Channels DVR server
  -v, --version         Print the version number

If no options are specified, use the default URL: 127.0.0.1:8089

If you provide the IP address, it needs to be in quotes: -i "192.168.0.155".
If you provide the port number, it just needs to be an integer value: -p 8090.

If you call this script on the same machine where the Channels DVR server is running too, no need to specify any options.

On Windows, you should be able to just double click on it in Windows Explorer, as long as *.py files are registered in Windows to be opened with Python by default.

Example:

PS C:\Users\mjitk\Documents\Scripts> python .\cdvr_movie_library_to_csv.py
Using Channels DVR server at: http://127.0.0.1:8089

Getting the list of movies from Channels DVR...
Got 1480 movies.

Writing the list of movies to the CSV file...
Movie list available in channels_dvr_movie_list_20230306_180057.csv

PS C:\Users\mjitk\Documents\Scripts>

After some manual formatting of the CSV file in Microsoft Excel, it looks like this:

I am not an expert with Python and I'm not ashamed to admit that I used Google and ChatGPT to write some parts of this script.

I'm sure there are ways to improve/optimize this script.
Let me know if you have any comments, questions, or bug reports.
I will do my best to support it as much as possible.

I hope it works for you! :slight_smile:

2 Likes