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

Problems with setup #3

Closed
jussbba opened this issue Oct 3, 2019 · 19 comments
Closed

Problems with setup #3

jussbba opened this issue Oct 3, 2019 · 19 comments
Assignees
Labels
bug Something isn't working

Comments

@jussbba
Copy link

jussbba commented Oct 3, 2019

Hello,

I have few problems concerning the installation.

But first I'd like to ask will this be able to show and update all new podcasts for example from aamulypsy to the feed. Or do I need to manually enter all the episodes (links) I want into the feed?

This would be a game changer for me since now I have to manually find the .mp4 url by inspecting the network connections at supla.fi and paste the url to my LMS (logitech media server).

I am trying to run the program on windows and I have python installed.
However it is giving me an error when trying to run it:


`C:\supla-rssproxy-master>python supla_rssproxy/main.py --config-file podcast.json
[2019-10-03 13:02:07.804632] Fetching 3482381
Traceback (most recent call last):
File "C:\python\lib\site-packages\urllib3\connection.py", line 157, in _new_conn
(self._dns_host, self.port), self.timeout, **extra_kw
File "C:\python\lib\site-packages\urllib3\util\connection.py", line 61, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "C:\python\lib\socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\python\lib\site-packages\urllib3\connectionpool.py", line 672, in urlopen
chunked=chunked,
File "C:\python\lib\site-packages\urllib3\connectionpool.py", line 376, in _make_request
self._validate_conn(conn)
File "C:\python\lib\site-packages\urllib3\connectionpool.py", line 994, in _validate_conn
conn.connect()
File "C:\python\lib\site-packages\urllib3\connection.py", line 334, in connect
conn = self._new_conn()
File "C:\python\lib\site-packages\urllib3\connection.py", line 169, in _new_conn
self, "Failed to establish a new connection: %s" % e
urllib3.exceptions.NewConnectionError: <urllib3.connection.VerifiedHTTPSConnection object at 0x0000020497A2B908>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "C:\python\lib\site-packages\requests\adapters.py", line 449, in send
timeout=timeout
File "C:\python\lib\site-packages\urllib3\connectionpool.py", line 720, in urlopen
method, url, error=e, _pool=self, _stacktrace=sys.exc_info()[2]
File "C:\python\lib\site-packages\urllib3\util\retry.py", line 436, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='supla-prod-component-api.nm-services.nelonenmedia.fi', port=443): Max retries exceeded with url: /api/component/2600350?offset=0&current_primary_content=podcast&current_series_content_order_direction=desc&current_series_id=2256169&app=supla&client=web (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0000020497A2B908>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "supla_rssproxy/main.py", line 261, in
main()
File "C:\python\lib\site-packages\click\core.py", line 764, in call
return self.main(*args, **kwargs)
File "C:\python\lib\site-packages\click\core.py", line 717, in main
rv = self.invoke(ctx)
File "C:\python\lib\site-packages\click\core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "C:\python\lib\site-packages\click\core.py", line 555, in invoke
return callback(*args, **kwargs)
File "supla_rssproxy/main.py", line 250, in main
rss_data = get_rss_data(supla_id)
File "supla_rssproxy/main.py", line 106, in get_rss_data
episodes, series_name = fetch_series(supla_id)
File "supla_rssproxy/main.py", line 79, in fetch_series
return fetch_episodes_json(series_id), series_name
File "supla_rssproxy/main.py", line 59, in fetch_episodes_json
first_req = json.loads(requests.get(url, params=params).text)
File "C:\python\lib\site-packages\requests\api.py", line 75, in get
return request('get', url, params=params, **kwargs)
File "C:\python\lib\site-packages\requests\api.py", line 60, in request
return session.request(method=method, url=url, **kwargs)
File "C:\python\lib\site-packages\requests\sessions.py", line 533, in request
resp = self.send(prep, **send_kwargs)
File "C:\python\lib\site-packages\requests\sessions.py", line 646, in send
r = adapter.send(request, **kwargs)
File "C:\python\lib\site-packages\requests\adapters.py", line 516, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='supla-prod-component-api.nm-services.nelonenmedia.fi', port=443): Max retries exceeded with url: /api/component/2600350?offset=0&current_primary_content=podcast&current_series_content_order_direction=desc&current_series_id=2256169&app=supla&client=web (Caused by NewConnectionError('<urllib3.connection.VerifiedHTTPSConnection object at 0x0000020497A2B908>: Failed to establish a new connection: [Errno 11001] getaddrinfo failed'))`


I installed click (pip3 install click) and requests (pip3 install requests) because they were missing.
Do I need to install something else for it to work?

I am very amateur when it comes to command prompt but I am willing to learn.

Thank you very much!

@fennekki
Copy link
Owner

fennekki commented Oct 3, 2019

It's entirely possible that setup.py is broken - I have a tendency to forget keeping it functional because Pipfile already contains the dependencies in the development setup. I'll take a look.

The way it works is that you add the link to a single episode manually in the configuration (in the manner described in the readme) after which the tool will look up the series and create a RSS file with every episode in it.

The errors seem to suggest to me that the API has moved again, but I'll have to check.

@fennekki
Copy link
Owner

fennekki commented Oct 3, 2019

I think I'e figured out the fix, I expect to be able to work on all this later tonight. The API has changed but only a little bit. If you want to try a quick fix, it should be enough to replace supla-prod-component-api with prod-component-api on line 47 of main.py.

Additionally I only now noticed you're directly running main.py which sounds like you haven't installed the script. That shouldn't be a problem but perhaps explains why you needed to manually install the dependencies.

@fennekki
Copy link
Owner

fennekki commented Oct 3, 2019

Anyway, to better address your first point:

The tool exists to generate a file containing a valid RSS feed automatically from a Supla series. The reason you add links to episodes in the configuration file is that supla does not (or at least did not) have useful pages for series, only episodes, so the script has to start from a single episode of the series, but will find all other episodes automatically.

Note that the program will only generate the RSS feed, then quit. You can use a tool like cron to schedule it to run eg. once a day if you want to automatically update the feed. Also note that it currently only looks for audio files, not video.

@jussbba
Copy link
Author

jussbba commented Oct 3, 2019

Thank you for your reply! That sounds amazing.

I changed supla-prod-component-api with prod-component-api and now I get the following error:

C:\supla-rssproxy-master>python supla_rssproxy/main.py --config-file podcast.json [2019-10-03 14:54:27.257295] Fetching 3482381 Traceback (most recent call last): File "supla_rssproxy/main.py", line 261, in <module> main() File "C:\python\lib\site-packages\click\core.py", line 764, in __call__ return self.main(*args, **kwargs) File "C:\python\lib\site-packages\click\core.py", line 717, in main rv = self.invoke(ctx) File "C:\python\lib\site-packages\click\core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params) File "C:\python\lib\site-packages\click\core.py", line 555, in invoke return callback(*args, **kwargs) File "supla_rssproxy/main.py", line 250, in main rss_data = get_rss_data(supla_id) File "supla_rssproxy/main.py", line 113, in get_rss_data for ep in episodes["items"]: KeyError: 'items'

About the script I haven't installed; How can I install it?

About my goal. I am running a LMS (logitech media server) on raspberry pi and it is accesible via private ip. There is a place for RSS feeds which are hosted online in the LMS menu. However, I am not planning to host this "supla feed" online. I just want to listen it locally on my multiroom soundsystem.

Is it required to host the feed somewhere? Or how can I add it to the feeds in my LMS.

Thanks alot!

@fennekki
Copy link
Owner

fennekki commented Oct 3, 2019

Well, it looks like there's some other work to be done too in addition to just the minor fix, then.

The script creates a file for each podcast name in the configuration dictionary. Each of these files contains a perfectly functional RSS feed, so if you can enter file:/// urls or something in there, you should be set. The only reason you're required to configure the hosting URL is that the RSS spec either requires or recommends (I forget which) that the RSS feed contains information about where it's hosted. It should work just fine with a dummy value as well.

Certainly there is no need to host the feeds anywhere online. If nothing else works, you can probably setup a web server on your raspberry pi for the feeds, though.

@fennekki fennekki self-assigned this Oct 3, 2019
@fennekki fennekki added the bug Something isn't working label Oct 3, 2019
@fennekki
Copy link
Owner

fennekki commented Oct 3, 2019

It seems that Aamulypsy is in some way different from other podcasts on Supla. None of the ones I've usually tested have the issue but Aamulypsy does. Working on it.

Also, the way you install the package is by running pip install ., which will hopefully make the supla-rssproxy command available. It's not necessary though, and it turns out that setup.py is indeed broken, so you won't really get any benefit from installing right now.

@fennekki
Copy link
Owner

fennekki commented Oct 3, 2019

Turns out the podcast has almost 8000 episodes so it needed pagination.

@jussbba I've pushed commit 5f265fe to branch issue-2-fix - try and see if this fixes your problem. This version introduces a new configuration parameter limit_recent which limits how many episodes are handled for the podcast, and it's set to 200 by default, as it seems numbers higher than that tend to make the API give up, so probably nobody had tried it on podcasts that big before. You can set this number as high as you want but it gets very slow past a few thousand.

Example configuration to use with that branch:

{
    "own_url": "file://tmp/",
    "target_dir": "/tmp/",
    "limit_recent": 100,
    "podcasts": {
        "aamulypsy": "https://www.supla.fi/audio/3483000"
    }
}

(Replace limit_recent, own_url and target_dir values with your own info of course)

@jussbba
Copy link
Author

jussbba commented Oct 3, 2019

Thank you very much!

I will test it.

@jussbba
Copy link
Author

jussbba commented Oct 3, 2019

It does create the .rss file but I can't in the earth figure out how to play it or view the episode list. I don't know where should I put it for test. I don't know what to put to the host section

@jussbba
Copy link
Author

jussbba commented Oct 3, 2019

The feed needs to be accessible from outside of my networks since it has to be set up from https://www.mysqueezebox.com/user/apps --> screenshot https://imgur.com/a/fMnYEee

I tried to create free website and place the .rss file there but it seems to be in the wrong format when opening it in the web browser. At least it won't play--> http://supla.epizy.com/aamulypsy.rss

I am out of ideas really. Should I have a real website where I place the .rss file. But then the problem is how to update it everyday automatically.

@fennekki
Copy link
Owner

fennekki commented Oct 3, 2019

For your particular scenario, would it be aceptable to upload some other kind of file format to the device?

@jussbba
Copy link
Author

jussbba commented Oct 3, 2019

Well, I think the media server does accept playlist files which are formated as .m3u

For other kind of file formats, I don't really have a clue.

edit. Link: http://wiki.slimdevices.com/index.php/Internet_radio

@jussbba
Copy link
Author

jussbba commented Oct 3, 2019

OMG, it is actually working now!

I had to point out the file like you mentioned earlier: file:///mnt/mmcblk0p2/tce/slimserver/prefs/aamulypsy.rss

This is a game changer. Thank you very much!

Now I just need to figure out how could I update the file.

I have a spare raspberry pi zero. Could I use it as a local webserver and run the script once a day and store the updated .rss file to some location? And the access to it from media server like this 192.168.1.3:port, or whatever the web server ip is?

@jussbba
Copy link
Author

jussbba commented Oct 3, 2019

I even overrided the old .rss file with new one (with more episodes) with ftp connection and it updated right away without reboot needed, nice.

However, it would be excellent if it was automatic

@fennekki
Copy link
Owner

fennekki commented Oct 4, 2019

Good that it ended up working for you.

A way to automate this might be using something like cron on your raspberry pi to run the script on your raspberry pi. You can look up for documentation on cron online. Usually the command you use to edit the list of automated commands is crontab -e, and there's a lot of websites like https://crontab.guru/ that could help you actually make the syntax (In this case something like 0 8 * * * /path/to/supla-rssproxy/supla_rssproxy/main.py --config-file /path/to/config/file to run it every day at 8am.)

That seems to be beside the point of this issue though, as there are a lot of ways to automate software. Hope it helps though!

@fennekki fennekki closed this as completed Oct 4, 2019
@fennekki
Copy link
Owner

fennekki commented Oct 4, 2019

whoops didn't mean to close this from here

@fennekki fennekki reopened this Oct 4, 2019
@fennekki fennekki closed this as completed Oct 4, 2019
@jussbba
Copy link
Author

jussbba commented Oct 4, 2019

I think I got it working now.

I installed raspbian, apache, python3, php and supla-rss-proxy and set a cron to run the script everyday at 16:00 like this: 0 16 * * * /usr/bin/python3 /home/pi/supla-rssproxy/supla_rssproxy/main.py --config-file /home/pi/supla-rssproxy/conf.json

It saves the file to the www folder on my raspberry pi. (/var/www/html)
Then I can access the file via this ip address: http://192.168.1.xx/aamulypsy.rss on my LMS

Thank you!

@jussbba
Copy link
Author

jussbba commented Oct 5, 2019

I was wondering would it be hard/possible to add icons for the episodes. I am usually streaming on my tv and it is showing the ”album art” on the screen for music for example. For supla episodes, there are no pictures (Pic: https://imgur.com/a/Ib43WuN)

It wouldn’t matter if the icon is same for every episode (e.g supla icon from internet) or some local image file.

Of course this is just aesthetic request and I don’t expect that this should be available. This is more like just an suggestion/idea if you have the time and interest.

Thank you for your contribution!

@fennekki
Copy link
Owner

fennekki commented Oct 5, 2019

It's possible, and I've looked into doing it, but I don't want to make the configuration too complex and it's currently a bit difficult to pull episode or series logos from supla. I might eventually get around to it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants