Chromecast backgrounds RSS

Chromecast backgrounds RSS

Postby Antonio Linares » Wed Jul 17, 2019 2:38 pm

I have been using John's Background switcher for years, and since I tested the Chromecast screensaver I wanted to have all those great photos available on my desktop too

Today I found a GitHub project that provides a list of Chromecast photos with 700 photos, so I used this small PRG to turn it into a valid RSS:

https://github.com/FiveTechSoft/chromecast-backgrounds

Code: Select all  Expand view  RUN
#define CRLF Chr( 13 ) + Chr( 10 )

function Main()
   
   local aLines := HB_aTokens( MemoRead( "README.md" ), Chr( 10 ) )
   local cRSS
 
   cRSS = '<?xml version="1.0" encoding="utf-8"?>' + CRLF
   cRSS += '<rss version="2.0">' + CRLF
   cRSS += '<channel>' + CRLF
   cRSS += "<title>chromecast-backgrounds</title>" + CRLF
   cRSS += "<link>https://github.com/FiveTechSoft/chromecast-backgrounds</link>" + CRLF
   cRSS += "<description>dconnolly chromecast-backgrounds collection</description>" + CRLF
 
   AEval( aLines, { | cLine, n | cRSS += StrTran( StrTran( cLine, "![](", "<item>" + CRLF + ;
          "<title>" + AllTrim( Str( n ) ) + "</title>" + CRLF + "<link>" ), ")",;
          "</link>" + CRLF + "</item>" ) + CRLF } )
   
   hb_MemoWrit( "test.rss", SubStr( cRSS, 1, Len( cRSS ) - 2 ) + "</channel>" + CRLF + "</rss>" )

return nil


So I forked the GitHub project, and added the RSS feed and it is working really fine from John's Background switcher:
https://raw.githubusercontent.com/FiveTechSoft/chromecast-backgrounds/master/test.rss
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42168
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Chromecast backgrounds RSS

Postby hmpaquito » Wed Jul 17, 2019 5:28 pm

Impresionantes fotos.
hmpaquito
 
Posts: 1482
Joined: Thu Oct 30, 2008 2:37 pm

Re: Chromecast backgrounds RSS

Postby Antonio Linares » Wed Jul 17, 2019 7:39 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42168
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Chromecast backgrounds RSS

Postby Antonio Linares » Sat Apr 04, 2020 9:11 pm

Here there is a JSON file with lots of ChromeCast pictures:
https://chromecastbg.alexmeub.com/images.v9.json

This PRG generates a RSS file from it:
Code: Select all  Expand view  RUN
#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local aImages := hb_JsonDecode( MemoRead( "c:\temp\images.v9.json" ) )
   local hImage, cRSS
 
   cRSS = '<?xml version="1.0" encoding="utf-8"?>' + CRLF
   cRSS += '<rss version="2.0">' + CRLF
   cRSS += '<channel>' + CRLF
   cRSS += "<title>chromecast-backgrounds</title>" + CRLF
   cRSS += "<link>https://github.com/FiveTechSoft/chromecast-backgrounds</link>" + CRLF
   cRSS += "<description>dconnolly chromecast-backgrounds collection</description>" + CRLF
   
   for each hImage in aImages
      cRSS += "<item>" + CRLF
      cRSS += "<title>" + AllTrim( Str( hImage:__enumIndex ) ) + "</title>" + CRLF
      cRSS += "<link>" + hImage[ "url" ] + "</link>" + CRLF
      cRSS += "</item>" + CRLF
   next
   
   cRSS += "</channel>" + CRLF
   cRSS += "</rss>"
   
   hb_MemoWrit( "c:\temp\images.v9.rss", cRSS )

return nil


Here it is the resulting RSS file:
https://raw.githubusercontent.com/FiveTechSoft/chromecast-backgrounds/master/images.v9.rss
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42168
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Chromecast backgrounds RSS

Postby Antonio Linares » Sun Apr 05, 2020 5:49 am

I found an easy way to get all the photos that ChromeCast uses from its url:
https://clients3.google.com/cast/chromecast/home

Simply open it from Chrome, inspect it using F12 and select "network", click on "Preserve log" and wait...:
Image

Let it be there for hours, the log will grow, finally click on "down arrow" (Export HAR) and it will create a JSON file on disk.

Now use this PRG to extract the URLs from it:
rss.prg
Code: Select all  Expand view  RUN
#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local hInfo := hb_JsonDecode( MemoRead( "c:\Users\anto\Downloads\clients3.google.com.har" ) )
   local hEntry, cRSS

   cRSS = '<?xml version="1.0" encoding="utf-8"?>' + CRLF
   cRSS += '<rss version="2.0">' + CRLF
   cRSS += '<channel>' + CRLF
   cRSS += "<title>chromecast-backgrounds</title>" + CRLF
   cRSS += "<link>https://github.com/FiveTechSoft/chromecast-backgrounds</link>" + CRLF
   cRSS += "<description>chromecast-backgrounds collection</description>" + CRLF
   
   for each hEntry in hInfo[ "log" ][ "entries" ]
      if ! Empty( hEntry[ "request" ][ "method" ] )
         cRSS += "<item>" + CRLF
         cRSS += "<title>" + AllTrim( Str( hEntry:__enumIndex ) ) + "</title>" + CRLF
         cRSS += "<link>" + hEntry[ "request" ][ "url" ] + "</link>" + CRLF
         cRSS += "</item>" + CRLF
      endif
   next        

   cRSS += "</channel>" + CRLF
   cRSS += "</rss>"
   
   hb_MemoWrit( "c:\temp\clients3.google.com.har.rss", cRSS )

return nil


It will create a RSS file with all the photos URLs into it that you can use from John's Background Switcher for your PC desktop images:
https://raw.githubusercontent.com/FiveTechSoft/chromecast-backgrounds/master/clients3.google.com.har.rss
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42168
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Chromecast backgrounds RSS

Postby Antonio Linares » Sun Apr 05, 2020 6:16 am

A modified version to post the images here:

phpbb.prg
Code: Select all  Expand view  RUN
#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local hInfo := hb_JsonDecode( MemoRead( "c:\Users\anto\Downloads\clients3.google.com.har" ) )
   local hEntry, cRSS := ""

   for each hEntry in hInfo[ "log" ][ "entries" ]
      if ! Empty( hEntry[ "request" ][ "method" ] )
         cRSS += "[img]"%20+%20hEntry[%20"request"%20][%20"url"%20]%20+%20"[/img]" + CRLF
      endif
   next        
   
   hb_MemoWrit( "c:\temp\phpbb.post", cRSS )

return nil


Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
Image
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42168
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Chromecast backgrounds RSS

Postby Antonio Linares » Sun Apr 05, 2020 6:28 am

This version creates a md file that you can post on github:

md.prg
Code: Select all  Expand view  RUN
#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local hInfo := hb_JsonDecode( MemoRead( "c:\Users\anto\Downloads\clients3.google.com.har" ) )
   local hEntry, cRSS := ""

   for each hEntry in hInfo[ "log" ][ "entries" ]
      if ! Empty( hEntry[ "request" ][ "method" ] )
         cRSS += "![](" + hEntry[ "request" ][ "url" ] + ")" + CRLF
      endif
   next        
   
   hb_MemoWrit( "c:\temp\backgrounds.md", cRSS )

return nil


https://github.com/FiveTechSoft/chromecast-backgrounds/blob/master/backgrounds.md
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42168
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Chromecast backgrounds RSS

Postby Antonio Linares » Sun Apr 05, 2020 6:54 am

And a great music to listen meanwhile you watch the images :-D

https://journeyscapesradio.blogspot.com/p/radionomy-player.html
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42168
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Chromecast backgrounds RSS

Postby Antonio Linares » Sun Apr 05, 2020 11:02 pm

regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42168
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Chromecast backgrounds RSS

Postby Antonio Linares » Mon Apr 06, 2020 7:14 am

After saving the Chrome log file, use this PRG to save the images to local files:

saveimages.prg
Code: Select all  Expand view  RUN
#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local hInfo := hb_JsonDecode( MemoRead( "c:\Users\anto\Downloads\clients3.google.com.har" ) )
   local hEntry, aImages := {}, cImage

   for each hEntry in hInfo[ "log" ][ "entries" ]
      if ! Empty( hEntry[ "request" ][ "method" ] )
         if AScan( aImages, hEntry[ "request" ][ "url" ] ) == 0
            AAdd( aImages, hEntry[ "request" ][ "url" ] )
            hb_MemoWrit( "c:\temp\" + AllTrim( Str( Len( aImages ) ) ) + ".jfif",;
                         WebImage( hEntry[ "
request" ][ "url" ] ) )
         endif  
      endif
   next        
   
   MsgInfo( "
done" )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42168
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: Chromecast backgrounds RSS

Postby Antonio Linares » Tue Apr 14, 2020 7:18 am

Enhanced version that saves all the photos, and erase duplicated photos

chromebg.prg
Code: Select all  Expand view  RUN
// Download images from the ChromeCast backgrounds images log file in Chrome network inspector

#define CRLF Chr( 13 ) + Chr( 10 )

function Main()

   local hInfo := hb_JsonDecode( MemoRead( "c:\Users\anto\Downloads\clients3.google.com.har2.har" ) )
   local hEntry, aImages := {}, cImage, aFiles

   for each hEntry in hInfo[ "log" ][ "entries" ]
      if ! Empty( hEntry[ "request" ][ "method" ] )
         if AScan( aImages, hEntry[ "request" ][ "url" ] ) == 0
            AAdd( aImages, hEntry[ "request" ][ "url" ] )
            hb_MemoWrit( "c:\Users\anto\pictures\" + DToS( Date() ) + "_" + hb_ntos( Seconds() ) + ".jfif",;
                         WebImage( hEntry[ "
request" ][ "url" ] ) )
         endif  
      endif
   next        

   aFiles = Directory( "
c:\Users\anto\pictures\*.jfif" )
   ASort( aFiles,,, { | x, y | If( x[ 2 ] == y[ 2 ], FErase( "
c:\Users\anto\pictures\" + y[ 1 ] ),), x[ 2 ] < y[ 2 ] } )
   
   MsgInfo( "
done" )

return nil
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 42168
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain


Return to Off Topic / Otros temas

Who is online

Users browsing this forum: No registered users and 1 guest