Heckie75 / kodi-addon-podcast

Subscribe to podcasts in KODI
MIT License
14 stars 3 forks source link

Support for servers implementing GPodder API #21

Open castle-giant opened 1 year ago

castle-giant commented 1 year ago

I'm using https://apps.nextcloud.com/apps/gpoddersync in order to sync podcasts and I tried manually changing "https://www.gpodder.net:443" to my own domain but received a 404 error[1]. Would you please consider supporting custom domains that implement the gpodder API?

1 - "POST /api/2/auth/Leigh/login.json HTTP/1.1" 404 5951 "-" "plugin.audio.podcasts/2.2.3 (Kodi/20.1)" 10:21 AM

Heckie75 commented 1 year ago

@castle-giant maybe the problem is that the user name is expected in lower case. Could you pls. give it a try?

castle-giant commented 1 year ago

Yes, unfortunately trying that returned the same result.

Heckie75 commented 1 year ago

@castle-giant I guess that the API is a little bit different or needs different requests, see https://github.com/thrillfall/nextcloud-gpodder/.

Since I don't have nexrtcloud installed, do you think that you think that you can provide me access to a test system?

castle-giant commented 1 year ago

I could definitely spin something up. Might take a few days but I'll get it done.

castle-giant commented 1 year ago

@Heckie75 I've got a test environment set up, what's the best way to get you the credentials?

Heckie75 commented 1 year ago

@castle-giant Maybe you can send it via e-mail. I am going to write the address in the next comment which I will delete as soon as I have received your e-mail.

castle-giant commented 1 year ago

sent

Heckie75 commented 1 year ago

@castle-giant thanks, I have received it. I hope that I will have some time for the first look on Sunday.

castle-giant commented 1 year ago

Do you think you'll need ssh access to the box too?

Heckie75 commented 1 year ago

@castle-giant I don't think so. API access should be fine.

Heckie75 commented 1 year ago

@castle-giant I've played with the API and it seems to be pretty simple. It utilizes HTTP Basic authentification. Everything else is as described in https://github.com/thrillfall/nextcloud-gpodder/

I don't have much time. Maybe I'll be able to implement integration soon. In order to have an environment for implementation I would like to ask you to keep my account for this environment.

Best regards

Note: Server doesn't seem to use HTTPS/SSL. Therefore credentials aren't encrypted when using the API.

castle-giant commented 1 year ago

Thanks for reminding me, I've enabled TLS.

Heckie75 commented 1 year ago

@castle-giant Fine, https also works now.

Heckie75 commented 1 year ago

@castle-giant I have developed the first version. It is an early one that is not tested that well. If you are experienced you can download the ZIP file and install it directly, see https://github.com/Heckie75/kodi-addon-podcast/blob/plugin.audio.podcasts.2.3.0/plugin.audio.podcasts.2.3.0.zip

The first impression is good. You start synchronisation from the settings menu.

From my point of view the following is missing:

  1. Action in settings menu in order to push local feeds to Nextcloud that are not listed there
  2. Automatic synchronisation: the idea was that this will be triggered once in a while if you start browsing and last synchronisation exceeded specific time

Note, that is an alpha version ;-)

Heckie75 commented 1 year ago

@castle-giant I have finished integration of Nextcloud sync. In addition I found the rss directory called fyyd.de. I have also added the possibility to search for podcasts there and directly subscribe to them.

The changes are not available in Kodis repo yet. If you want to test the addon, you can download it here plugin.audio.podcasts.2.3.0.zip

update-freak commented 10 months ago

I have a similar problem and reach the 404 error. But for gpodder I use the docker container of https://github.com/SamTV12345/PodFetch. Here I created an gpodder Account with works fine with AntennaPod with my custom domain, e.g. https://podfetch.testurl.dynv6.net

I tried to login (for gpodder and gpodder for Nextcloud), but both did not work. It would be great if you could also support accounts from podfetch. Thank you very much.

Heckie75 commented 10 months ago

@update-freak Neither I can call the mentioned dynv6-URL nor can I find any documentation for Podfetch.

update-freak commented 10 months ago

The dynv6-URL is only an example (which not exist), which URL I use to log in into the gpodder.net-synchronisation settings in AntennaPod.

You will find information about the GPodder API implementation here: https://github.com/SamTV12345/PodFetch#gpodder-api

Heckie75 commented 10 months ago

@update-freak According the API documentation of PodFetch the APIs are identical to GPodder.net.

Since I have no system to test I'm not able to find out what that problem is. At least I would need kodi.log file or other detailed information what went wrong.

update-freak commented 10 months ago

Here is the log-file: kodi.log

Heckie75 commented 10 months ago

@update-freak It seems that PodFetch does not implement the whole Gpodder-API that is described here: https://gpoddernet.readthedocs.io/en/latest/api/index.html

My kodi-addon uses the following endpoint in order to get all subscriptions:

GET /subscriptions/(username).(format)

According the code that I have found in PodFetch there is only the following API endpoint in order to retrieve subscriptions for a specific device:

GET /subscriptions/(username)/(deviceid).(format)

see code https://github.com/SamTV12345/PodFetch/blob/main/src/gpodder/subscription/subscriptions.rs

You can try the following: In Kodi addon find file plugin.audio.podcasts/resources/lib/podcasts/gpodder.py

Open the file in editor and change the following code:

Current:

class GPodder:

    _GPODDER_API = {
        "login": "%s/api/2/auth/%s/login.json",
        "subscriptions": "%s/subscriptions/%s.%s"
    }

Change to

class GPodder:

    _GPODDER_API = {
        "login": "%s/api/2/auth/%s/login.json",
        "subscriptions": "%s/subscriptions/%s/mykodi.%s" # make change here
    }

Let's see what happens and let me know!

If this works then I could introduce a new setting in order to give the Kodi-device an ID.

If PodFetch has a web-interface it is probably required to make the device 'mykodi' known to PodFetch first.

Heckie75 commented 10 months ago

I guess it is described here how to add a new device: https://github.com/SamTV12345/PodFetch/wiki/GPodder-API#3-choose-an-existing-device-or-create-a-new-device

update-freak commented 10 months ago

In my current setup I have the device "Podcasts" which I use on both AntennaPod-Apps on 2 Smartphones to have the watched-Status synchonised --> this means I use Podcasts for both, not Smartphone-1 and Smartphone-2 as separate device. podcasts

Therefore I used you modification of the gpodder.py and changed mykodi to Podcasts to have Kodi in this "device-group" (=Smartphone 1, Smartphone 2, Kodi)

"subscriptions": "%s/subscriptions/%s/Podcasts.%s" # make change here

I tried i then again I got this error again: 20231028_182036

A basis question: Which is the correct URL I have to use, because the default is which 443 https://podfetch.testurl.dynv6.net https://podfetch.testurl.dynv6.net:443 -> I tried it which both and got the same error.

Heckie75 commented 10 months ago

@update-freak According your question to the correct URL with or without port 443. The 443 is the default port for HTTPS. Since it is the default it is optional to write ':443'.

The 404 error still indicates that the URL is wrong. Maybe the name of the device is not correct since an ID is expected.

You can try to open the web-app of podfetch. After you are logged in you can call this URL in your browser:

https://podfetch.<...>:443/devices/<username>.json

also possible that URL is like this

https://podfetch.<...>:443/api/2/devices/<username>.json

Replace username. The result is a so called json structure. You will understand it and get the technical ID of devices.

Then you can also check if fetching the podcasts works by directly call the API in your browser:

https://podfetch.<...>:443/api/2/subscriptions/<username>/<device>.json

or 

https://podfetch.<...>:443/subscriptions/<username>/<device>.json
Heckie75 commented 10 months ago

Note to myself: podfetch doesn't support opml. Format is json only. Most likely correct url is:

https://podfetch.<...>:443/api/2/subscriptions/<username>/<device>.json
SamTV12345 commented 10 months ago

Note to myself: podfetch doesn't support opml. Format is json only. Most likely correct url is:

https://podfetch.<...>:443/api/2/subscriptions/<username>/<device>.json

Hi PodFetch creator,

I support the following API endpoints:

Heckie75 commented 10 months ago

@SamTV12345

Thanks for your answer. The endpoints are definitely good enough for the Kodi-addon. However, the addon was originally written for gpodder.net.

If possible it would be great if you can grant me access to a test system for development ;-)

SamTV12345 commented 10 months ago

@SamTV12345

Thanks for your answer. The endpoints are definitely good enough for the Kodi-addon. However, the addon was originally written for gpodder.net.

If possible it would be great if you can grant me access to a test system for development ;-)

You're welcome. I do my best to answer everyone haha. So you simply need a PodFetch server? You can spin up one pretty easily with docker/docker compose. I could also setup an instance for you if you want to.

Heckie75 commented 10 months ago

@SamTV12345 I was able to establish my own instance based on docker-compose-postgres.yml

BTW: I'm not sure if it is my fault but the SQLite version (docker-compose.yml) ends with an error:

podfetch_1  | Debug file located at /home/rust/src/target/x86_64-unknown-linux-musl/release/build/podfetch-b6c7bad76ef0c043/out/built.rs
podfetch_1  | thread 'main' panicked at src/main.rs:450:24:
podfetch_1  | called `Result::unwrap()` on an `Err` value: Error(Some("Unable to open the database file"))
podfetch_1  | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ramdisk_podfetch_1 exited with code 101
SamTV12345 commented 10 months ago

@SamTV12345 I was able to establish my own instance based on docker-compose-postgres.yml

BTW: I'm not sure if it is my fault but the SQLite version (docker-compose.yml) ends with an error:

podfetch_1  | Debug file located at /home/rust/src/target/x86_64-unknown-linux-musl/release/build/podfetch-b6c7bad76ef0c043/out/built.rs
podfetch_1  | thread 'main' panicked at src/main.rs:450:24:
podfetch_1  | called `Result::unwrap()` on an `Err` value: Error(Some("Unable to open the database file"))
podfetch_1  | note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
ramdisk_podfetch_1 exited with code 101

Yes this is a known "issue" you need to adapt the docker-compose to the user id and group id of the user that starts the docker compose.

update-freak commented 9 months ago

Any news on that issue?

Heckie75 commented 9 months ago

Not yet, unfortunately.

update-freak commented 7 months ago

@Heckie75 Could you please try the version v4.6.0 (https://github.com/SamTV12345/PodFetch/releases/tag/v4.6.0) of PodFetch

Heckie75 commented 7 months ago

@update-freak Hi, I was able to run the binary on my Ubuntu Linux w/o any problems. According the Kodi podcast addon there was no progress the last months so that it does not use the required APIs to use PodFetch. Unfortunately It's a matter of time ;-)

What should I test in particular?

update-freak commented 7 months ago

@Heckie75 Ah ok, nice. I thought there were still problems with setting up PodFetch. That's why I wanted to ask. But good if it's only a matter of time :D

update-freak commented 2 months ago

Let me know when I can help or test something related to the PodFetch implementation for Gpodder 😉