Playstation 4/PS4 custom component

This is really cool. It works quite well, but I don’t see any media images. Where do these come from? I see that there is a json file woth all games, but it does not contain any links to image URLs or similar.
What do I have to do to add the media images?

As you can read in the documentation on https://github.com/hmn/home-assistant-config/wiki/media_player_ps4 the images are mapped using this site http://kiot.nl/game-images-2/ so you can add any games that are missing

Ok, I now see this. However, I strongly recommend to change the code. As it is right now requests the image from your(?) web site every time the frontend is displayed. That is s serious privacy problem as it means the web site will track all users and what they are doing when with their PS4.
You should at least store the retrieved URLs locally (e.g. in the JSON file that is already there) and use the web service only if there is no image URL known.

This is what i was thinking about the last 2 days. To store them into the json file is a good idea. So that mean less request to the site and more privacy for the users :thumbsup: .

1 Like

Yes the image stuff is not a good solution at the moment, I thought about changing it so it’s just a static json file in a github project and then download the file if it’s been updated and do lookups in that

then there would be no need for anyone to do server setups, and anyone would be able to either have their own version or do pull requests

I changed the image handling to a github project and get the data then setting up the platform, so there is no information leak, and the speed should be better as well because all maps are in memory.

If games are missing just create a pull request

I also added a config option if you want to point to your own mapping file

@hmn

Before i get started, i noticed you don’t !include the custom_component/media_player directory.

Does this dir get included automatically then?

Thanks

Yes, for more info see https://home-assistant.io/developers/component_loading/

Literally just saw that. Cheers mate should have looked first

@hmn
Hi mate

Iv got your component all working now. I installed ps4-waker with sudo in root so needed to adjust cmd in your script to include sudo before everything. I also removed the ports/host/credentials etc as they were preventing mine from working - prob as the directory was wrong:

cmd = ‘ps4-waker -c ’ + self._credentials +
’ -d ’ + self._host +
’ -t 5000’ + bind_port +
’ ’ +
command

to:
cmd = 'sudo ps4-waker ’ +
’ ’ +
command

It all works now.

Im just trying to get the images to show, this is my config:

  • platform: ps4
    host: 192.168.0.30
    games_filename: ‘games.json’

games.json is in the same directory as my credentials.json file.

I added my games to games.json:

{ "CUSA00127": "https://d2ygrtdi28m8fp.cloudfront.net/corporateAssets/Netflix_Logo_DigitalVideo_0701.jpg", "CUSA00219": "http://assets.vg247.com/current//2016/06/destiny_rise_of_iron_5.jpg", "CUSA00411": "http://officialrtv.com/wp-content/uploads/2013/09/GTA-V-Wallpaper-Full-HD-Background-Pictures.jpg", "CUSA01116": "https://i.ytimg.com/vi/s5y-4EpmfRQ/maxresdefault.jpg", "CUSA01262": "https://media.playstation.com/is/image/SCEA/tom-clancys-the-division-listing-thumb-01-ps4-us-02aug16?$Icon$", "CUSA01433": "http://cdn3.dualshockers.com/wp-content/uploads/2017/02/Rocket-League-1.jpg", "CUSA01692": "http://static.commentcamarche.net/www.commentcamarche.net/actualites/images/vevo-301.png", "CUSA01703": "http://cdn1.expertreviews.co.uk/sites/expertreviews/files/2016/12/plex.jpg", "CUSA01780": "https://cdn3.tnwcdn.com/wp-content/blogs.dir/1/files/2015/07/Screen-Shot-2015-07-20-at-7.48.32-PM.png", "CUSA02369": "https://i.ytimg.com/vi/kLmEkhG3TrE/maxresdefault.jpg", "CUSA02387": "http://media-www-battlefieldwebcore.spark.ea.com/content/battlefield-portal/nl_NL/_global_/_jcr_content/ccm/componentwrapper_0/components/opengraph/ogImage.img.jpg", "CUSA02491": "https://store.playstation.com/store/api/chihiro/00_09_000/container/DK/en/19/EP0006-CUSA02491_00-MASSEFFECT400000/1493709893000/image?_version=00_09_000&platform=chihiro&w=500&h=500&bg_color=000000&opacity=100", "CUSA02819": "https://inthegame.nl/wp-content/uploads/maxresdefault-6-7.jpg", "CUSA02993": "http://nos.nl/img/social/nos.jpg", "CUSA03214": "https://i.ytimg.com/vi/gXy1e5bGD80/maxresdefault.jpg", "CUSA04013": "https://media.playstation.com/is/image/SCEA/titanfall-2-listing-thumb-01-ps4-us-03jun16?$Icon$", "CUSA04294": "https://media.playstation.com/is/image/SCEA/watch-dogs-2-listing-thumb-01-ps4-us-06jun16?$Icon$", "CUSA05282": "https://resource.supercheats.com/library/2016/1478244285codinfinitewarfare.png", "CUSA05486": "http://wallpapercave.com/wp/02a9mCH.jpg", "CUSA06118": "https://inthegame.nl/wp-content/uploads/maxresdefault-6-7.jpg" **"CUSA02821": "https://media.playstation.com/is/image/SCEA/tom-clancys-ghost-recon-wildlands-screen-02-ps4-us-05oct16?$MediaCarousel_Original$"** }

But nothing is showing still.

Do you know where i’ve gone wrong at all?

Thanks again for the component - works great

you are mixing stuff up, so I updated the component to support running ps4-waker in sudo and added more detailed documentation to https://github.com/hmn/home-assistant-config/wiki/media_player_ps4 to clarify the games file and how image mapping works so I would recommend reading the new version

there also seems to be an error in ps4-waker 1.2.0 so you should run 1.1.1 until I have had time to investigate what the problem is and report it.

Thanks I’ll give it a go in a bit.

I’m still not clear where the game thumbnail comes from. I noticed your code references the github repository. Does it get the cusa and the artwork from your games.json there?

New code still doesn’t work with all that bind port, credentials stuff. Do you even need it? Works for e without it…

There’s also a rogue line of code right at end of the new script - line 314 I think.

I think I’ll just stick with my amended one for now

@hmn Here is already a… “Database” even with pictures: http://www.psdevwiki.com/ps4/Game_Titles

well it’s VERY limited, and almost no new titles exist on it, and a very low number of records have pictures.

there also is a lot of extra info on the list that is unnecessary so getting the list would take longer, and it would have to be parsed because the current format seems a bit messy, unless anyone knows how to get the content in a better format

Just saying, that there already is a database. By contributing to the wiki, it would also help this component.

True, but the format is pretty fucked up from a programmatic perspective, but I guess I can try looking into what possibilities there are for getting the table in something that could be used in the component

Can’t you just reference a local json file containing your own game titles and images n use that?

Hi and thanks for the awesome component! I’ve been using it for a couple of days now but then today it just stopped working. Then I remembered that I changed my ps4 connection from wireless to wired yesterday and checked if it had changed the local ip for my ps4 but it was the same. But I changed back to wireless just to see if that was the problem and sure enough it started to work again. Could anyone explain why this is? As I said the ps4 still has the same ip adress. Maybe I’m being a bit lazy because if I reinstall ps4-waker and the component it would probably fix itself but I thought if I could just make some minor adjustments to get it working on the wired connection to that would be great.
Any help would be greatly appreciated!

I’d like to know this as well, I tinkered with the code a little and replaced the imagemap URL with my own file but it didnt like it. It looks like it is looking for a URL?