Jump to content

shredder5262

Member
  • Posts

    9
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by shredder5262

  1. It's been a looooong while since I've messed with this , but here is the full thing to play a movie with preshow using HA. The script below requires parameters unique to your setup at the top, replace everything inside the '' including the brackets. This script is designed to return a list of all movies that have been unwatched and does not contain any movies with the tag of christmas, holiday, or Concert. It also excludes movies with the genre of Documentary (you can change this if you like). Once a random movie is selected, a few data points are output to a csv file for history tracking, this is not required for functionality, just a fun thing to look back on the history of what has been watched. If all has gone well, the movie should start with the preshow experience sequence designated for that movie based the on criteria that is set for sequences in the preshow experience addon. #Returns a list movie and movie ID #required param ID $username ='[kodi web username]' $pawd = '[kodi web userpassword]' $hostname = '[host ip address]' $port = '[web port number]' $secpwd = ConvertTo-SecureString $pawd -AsPlainText -Force $CSVfilepath = '[full path of csv file, including the name of the file]' ########################################################################### ########################################################################### $data = @{ 'jsonrpc' = '2.0' 'method' = 'VideoLibrary.GetMovies' 'id' = 1 params = @{ properties = @('genre','playcount','year') filter = @{ and = @{ field = 'playcount' operator = 'lessthan' value = '1' }, @{ field = "tag" operator = "doesnotcontain" value = @('Christmas','Holiday','Concert') }, @{ field = "genre" operator = "doesnotcontain" value = "Documentary" }, @{ field = "tag" operator = "doesnotcontain" value = "concert" } } } } $json = $data | ConvertTo-Json -Depth 100 $url = 'http://'+$hostname+':'+$port+'/jsonrpc' $mycreds = New-Object System.Management.Automation.PSCredential ($username, $secpwd) $webreq = Invoke-WebRequest -Uri $url -Credential $mycreds -Body $json -ContentType application/json -Method POST $unwatchedrandommovie = ($webreq.content|convertfrom-json).result.movies|get-random ########################################################################### ########################################################################### #Store the movie ID in a variable $pickedmovie = $unwatchedrandommovie ########################################################################### #Append movie to CSV file for tracking $now = Get-Date $Content = [PSCustomObject]@{MovieName = $pickedmovie.label; DateWatched=$now; Genre=$pickedmovie.genre[0];ReleaseYear=$pickedmovie.year|out-string} #Append to CSV $Content| Export-Csv -Path $CSVfilepath -Append -NoTypeInformation ########################################################################### ########################################################################### #Starts a PreShow Experience sequence $movieid = $pickedmovie.movieid $data = @{ 'jsonrpc' = '2.0' 'method' = 'Addons.ExecuteAddon' 'id' = 1 params = @{ addonid = 'script.preshowexperience' params = @{movieid = "$movieid"} } } $json = $data | ConvertTo-Json -Depth 100 $url = 'http://'+$hostname+':'+$port+'/jsonrpc' $mycreds = New-Object System.Management.Automation.PSCredential ($username, $secpwd) Invoke-WebRequest -Uri $url -Credential $mycreds -Body $json -ContentType application/json -Method POST |out-null Store this in a powershell file somewhere on your desktop or server. Next, you will need the HA agent installed on the machine that the script lives on...this is the forked version of the agent that is actively supported, but you can use the OG version if you like, but it is no longer actively being updated. https://github.com/hass-agent/HASS.Agent Once installed, and configured for your HA instance; create a Powershell command with entity type 'button'..give it a name and friendly name and point to the script using the full path of the script Afterwards you should have a button in the MQTT integration that initiates the script...you can do whatever you like with it from here. I have an automation that stops whatever is playing, clears the playlist, then starts the script which kicks off the preshow sequence. If you use this automation you will need to replace the media_player names with your kodi instance name and also the name of the button to whatever you named it in the Hass Agent. alias: Andrew Office - Kodi - PreShow Experience - Random Movie - Everyday sequence: - alias: Stop Currently Playing Item service: kodi.call_method metadata: {} data: method: Input.ExecuteAction action: stop target: entity_id: media_player.kodi_instancename - alias: Clear Current Playlist service: kodi.call_method metadata: {} data: method: Playlist.Clear playlistid: 0 target: entity_id: media_player.kodi_instancename - service: button.press metadata: {} data: {} target: entity_id: button.name of button entity for kodi script - alias: Open Player service: kodi.call_method metadata: {} data: method: Player.Open item: playlistid: 0 position: 0 target: entity_id: media_player.kodi_instancename mode: single icon: mdi:kodi Hope that helps, let me know if you have any questions. I don't come here much so you can send me a message on discord if you like. Discord name: shredder5262
  2. It's nice to see this add-on getting traction again since the abandonment of CV. I have always hated working this the menu system in this addon even since CV. In my opinion, It's too heavy and limited as an addon. I would propose taking the TMM anatomy approach of doing a standalone application that contains visualizers for users and a better menu system for sequence criteria that in the end would produce a sequence file or set of files for a lightweight version of pre-show experience add-on could use simply to interface with kodi processes.
  3. It would be nice to have some clearly written documentation on how to utilize Kodi api calls to communicate with sequencing. I use home assistant for automation which leverages the kodi call method to send commands to kodi and documentation on how to use add on api calls and syntax is CRUCIAL for that.
    i really dig the subtle action comics refs in these slides, i love nostalgic refs.
  4. ha! that's friggin awesome. I've been looking for someone to do a batman themed intro
  5. I would keep my home automation separate from Kodi, always, but the functionality to be able to trigger automation in PSE after an event is nice. I use Home Assistant for my home automation, so something to notify it either before or after a movie would be nice.
  6. You can trigger your lights with Home assistant and even do some more robust automation with it like turning off the projector/tv or sending a kodi call method to play some exit music. But the functionality to be able to trigger a script to notify home assistant at the end of a movie sequence would still be needed within the PSE add-on
  7. Agreed, I like to have my sequences trigger based on genre also. Horror movies have a halloween-esque sequence, action movies have an action sequence, etc. Along with this, different music for different slide decks, Horror may have scary music, whereas an action movie may be playing a james bond theme or some generic action tune And also, be able to handle multiple different slide decks, for example, a freddy slide deck and a jason slide deck and be able to shuffle them while still maintaining the q and a order
  8. In the current CV experience, I find it unclear what conditions have to be set to get the desired outcome of sequence selected. I understand it better now than i did at first, but it's something I had to spend an annoying amount of time trying to understand how it worked...and even then, I'm still not sure it was right, but i managed to find a 'medium' with it to make it work based of genre. For example, If I were to set a sequence to base off of a tag = marvel AND genre = action and all other fields are set to 'any' , it's not clear what field takes precedence and it gets further complicated when you have multiple values in multiple parameters at play. I guess in short, I'm asking for something as a weighted system for conditions that the user can see and identify that if i have parameters a,b,c with values x,y,z that the 'christmas' sequence will be triggered. along with this, some error handling or fallback sequence to trigger in the event that the condition failed. Hope this makes sense, but feel free to ask for clarification and i can include screenshots.
×
×
  • Create New...