SageTV Community  

Go Back   SageTV Community > SageTV Development and Customizations > SageTV Github Development

Notices

SageTV Github Development Discussion related to SageTV Open Source Development. Use this forum for development topics about the Open Source versions of SageTV, hosted on Github.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 04-25-2018, 09:00 AM
davidb's Avatar
davidb davidb is offline
Sage Advanced User
 
Join Date: Feb 2009
Posts: 129
How to Get Channel Logo FileName

I am wanting to get the filename for each channel logo. The api call GetChannelLogo can give me the logo but I need the filename of the png image. From searching the forums I see that they are stored in the GeneratedThumbnails directory. But I am unclear how to map a name such as:
url-https3a2f2fs32eamazonaws2ecom2fschedulesdirect2fassets2fstationLogos2fs586465fh35faa2epng
which is the png image file on my system for cnn. I found from using GetAllChannels I get back for the cnn example above this:
<Channel>
<ChannelDescription>
<![CDATA[ Cable News Network ]]>
</ChannelDescription>
<ChannelNetwork/>
<IsChannelViewable>false</IsChannelViewable>
<ChannelLogoURL>
<![CDATA[
"https://s3.amazonaws.com/schedulesdirect/assets/stationLogos/s10142_h3_aa.png"
]]>
</ChannelLogoURL>
<ChannelLogoCount>1</ChannelLogoCount>
<IsChannelObject>true</IsChannelObject>
<StationID>10142</StationID>
<ChannelNumber>
<![CDATA[ 202 ]]>
</ChannelNumber>
<ChannelName>
<![CDATA[ CNN ]]>
</ChannelName>
</Channel>

The url above does show the image but I need the filename of the image already in the GeneratedThumbnails directory. I don't see any part of the url that would match up with the filename. I also looked here:
"https://github.com/google/sagetv/wiki/Schedules-Direct-EPG-(BETA)"
but couldn't find the mapping info I need.


Does anyone know how to map the filenames in the GeneratedThumbnails to a channel name or number?

Last edited by davidb; 04-25-2018 at 12:05 PM.
Reply With Quote
  #2  
Old 04-26-2018, 11:09 AM
Narflex's Avatar
Narflex Narflex is offline
Sage
 
Join Date: Feb 2003
Location: Redondo Beach, CA
Posts: 6,308
Try the GetChannelLogoURL API call...that won't give you the GeneratedThumbnails path...but it will give you the URL to where you can download it from.
__________________
Jeffrey Kardatzke
Google
Founder of SageTV
Reply With Quote
  #3  
Old 04-26-2018, 01:35 PM
davidb's Avatar
davidb davidb is offline
Sage Advanced User
 
Join Date: Feb 2009
Posts: 129
I see that GetChannelLogoURL does return the url. I can go this route if I need to but using GetChannelLogoURL means I have to duplicate the channel logos that are already saved in the GeneratedThumbnails directory and will have to do a network request every 24 hours on every channel someone gets. This will have to happen for everyone that uses my IOS client. All for data that is already in the GeneratedThumbnails directory!

To illustrate what I mean the folllowing is using GetChannelLogo for CNN
Small Channel CNNHD 202 "https://s3.amazonaws.com/schedulesdirect/assets/stationLogos/s58646_h3_aa.png"
Med Channel CNNHD 202 "https://s3.amazonaws.com/schedulesdirect/assets/stationLogos/s58646_h3_aa.png"
Large Channel CNNHD 202 "https://s3.amazonaws.com/schedulesdirect/assets/stationLogos/s58646_h3_aa.png"

but buy copying the generatedThumbnails to another directory and doing a wildcard rename then loolking in explorer I see that on my system in the GeneratedThumbnails directory the cnn logo is:
url-https3a2f2fs32eamazonaws2ecom2fschedulesdirect2fassets2fstationLogos2fs586465fh35faa2epng

None of the portions of the filenames match up. If I can't find a way this could work but somewhere there has to be a mapping between the this png image in the GeneratedThumbnails directory and when sage UI needs to display the thumbnail for cnn. Sage knows how but I don't! LOL

Quote:
Originally Posted by Narflex View Post
Try the GetChannelLogoURL API call...that won't give you the GeneratedThumbnails path...but it will give you the URL to where you can download it from.

Last edited by davidb; 04-27-2018 at 05:39 AM.
Reply With Quote
  #4  
Old 04-26-2018, 03:58 PM
wnjj wnjj is offline
Sage Icon
 
Join Date: Jan 2009
Posts: 1,088
Sage uses this to convert the URL to a local cache name. Is that what you're looking for? It was in MetaImage.java

Code:
myCacheFile = new File(MediaFile.THUMB_FOLDER, "url-" + convertToAsciiName(src.toString()));
.
.
.
  public static String convertToAsciiName(String s)
  {
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < s.length(); i++)
    {
      char c = s.charAt(i);
      if (Character.isLetterOrDigit(c))
        sb.append(c);
      else
        sb.append(Integer.toString(c, 16));
    }
    return sb.toString();
  }
The letters & digits are left intact. The others are turned into 2-char hex (e.g. 3a = ':', 2f = '/')

Last edited by wnjj; 04-26-2018 at 04:07 PM.
Reply With Quote
  #5  
Old 04-27-2018, 06:54 AM
davidb's Avatar
davidb davidb is offline
Sage Advanced User
 
Join Date: Feb 2009
Posts: 129
Yes that is what I needed I just didn't know I needed it! I can now get the Channel Logos.

Thanks!

Quote:
Originally Posted by wnjj View Post
Sage uses this to convert the URL to a local cache name. Is that what you're looking for? It was in MetaImage.java

Code:
myCacheFile = new File(MediaFile.THUMB_FOLDER, "url-" + convertToAsciiName(src.toString()));
.
.
.
  public static String convertToAsciiName(String s)
  {
    StringBuffer sb = new StringBuffer();
    for (int i = 0; i < s.length(); i++)
    {
      char c = s.charAt(i);
      if (Character.isLetterOrDigit(c))
        sb.append(c);
      else
        sb.append(Integer.toString(c, 16));
    }
    return sb.toString();
  }
The letters & digits are left intact. The others are turned into 2-char hex (e.g. 3a = ':', 2f = '/')
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Filename scraper in bmt VCRUser Batch Metadata Tools 0 05-31-2017 07:19 PM
Channel in filename element33 SageTV Software 3 04-13-2011 08:11 AM
How do I get rid of the filename under cover art! datoney SageTV v7 Customizations 17 02-18-2011 05:23 AM
Filename problem davidw4021 SageTV Software 1 03-06-2009 02:35 PM
#'s in filename mean? xlr8shun SageTV Software 1 07-28-2004 11:44 AM


All times are GMT -6. The time now is 01:54 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2019, vBulletin Solutions Inc.
Copyright 2003-2005 SageTV, LLC. All rights reserved.