TV Guide (UK)

Same, I tried various variations and looking for announcements and anything in help/faq but nothing. The online Guide changed to a new look the same day and I initially thought it was just a change but still not been able to find anything to help with this method, not yet anyway…

Worth looking at the Freely API instead for future …

https://www.freely.co.uk/api/tv-guide?nid=64865&start=1759276800

This was from earlier. So probably needs a new start time, but sniffed from their website …

Yes same here and thats really annoying as this was a great addition and was working great. Anyone manage to set up a new one then please share…

OK, today I’ve fudged together a new way of grabbing the data … it’s very much a work in progress. Getting the images is to be done. Been trying to get it to work.

Anyway, if anyone wants to join in and try and fix this up, more than happy with some help …

Here’s an example of the basic usage at the moment.

2 Likes

OO, this is good news! We’re away for the weekend and will have a look when time permits (when I can get away with it!). Will have to look and see how you’re getting the data from the website…

Basically am downloading Freely one huge file, then splitting out into individual files for each channel. These are all hosted on GitHub to stop others hitting their link too often. Updates daily at midnight + 5 mins. Just doing daily schedules at the moment.

1 Like

Managed to get some time before bed, copied, pasted and it works a treat. More investigation after the weekend. Fingers are crossed!

1 Like

Made some tweaks to what shows. Should update at 4am now. Descriptions are empty due to the source info. So put secondary info there. Still working on images, but in no rush.

1 Like

This is great - thanks so much for tackling this! It all worked smoothly at first try (a novelty for me, as I am still very much finding my way with sensors/API etc) so the clear instructions were much appreciated.

Thank you @elyobelyob for working on the Freely API. I’ve successfully updated my home assistant dashboard using your code. I’ve also updated the code for my associated favourites card showing when your favourite shows are on.

Just for info, I also made a new implementation (screenshots below)… let me know if anyone wants to know how I did this…

I did this using a hacked version of HA-EPG integration.
It uses this XML feed… https://raw.githubusercontent.com/dp247/Freeview-EPG/master/epg.xml

The original HA-EPG uses a different feed without images, so I modified it to use the above feed to create a dictionary attribute of the entire today/tomorrow schedule with images.

Yes please. We’re on holiday, so it gives me something to look forward to when I get home!

In case it helps, I created GitHub - elyobelyob/freely_tv_guide_new to use that xml also … but to split into channels as I prefer …

Thank you! I’m working through the guide now.

@elyobelyob Your guide is working well!

I’ve done a bit of tinkering with your excellent work on the upcoming/expandable schedule, still working on the formatting but the info is there…

type: vertical-stack
cards:
  - type: markdown
    content: <img src="{{ states('sensor.media_look_up_logo') }}" alt="Amazon Music"/>
  - type: entities
    entities:
      - type: custom:hui-element
        card_type: markdown
        content: >-
          {% set evts = state_attr('sensor.epg_bbcone','event') or [] %} {% set
          nowts = now() %} {% set cutoff = now().replace(hour=6, minute=0,
          second=0, microsecond=0) + timedelta(days=1) %} {% set sorted = evts |
          sort(attribute='startTime') %} {% set summary_limit = 20 %} {% set ns
          = namespace(loop_count=0, summary_count=0) %} 

          {% if not sorted %}
            No upcoming programmes
          {% else %}
            {% for e in evts | sort(attribute='startTime') -%}
              {%- set featured = sorted[0] -%}
              {%- set f_start = as_local(as_datetime(e.startTime)) -%}
              {%- set f_end = f_start + timedelta(minutes=e.duration | int(0)) -%}
              {%- set ns.loop_count = ns.loop_count + 1 -%}
              {%- if f_end > nowts and f_start < cutoff -%}
                **{{ f_start.strftime("%H:%M") }} – {{ e.name }}**

                {%- if e.description %}
                {{ e.description }}
                {% endif %}

                {% if e.synopsis and e.synopsis != e.description %}
                _{{ e.synopsis }}_
                {%- endif -%}

                {%- if e.image -%}
                ![{{ e.name }}]({{ e.image }})
                {%- endif -%}
                {%- break -%}
              {% endif %}  
            {% endfor %}

            {% set remaining = sorted[ns.loop_count:] %}
            {% if remaining %}
            <details>
              <summary>Upcoming schedule (click to expand)</summary>
              {% for e in remaining %}
              {% set st = as_local(as_datetime(e.startTime)) -%}
              {%- set en = st + timedelta(minutes=e.duration | int(0)) -%}
              {%- if ns.summary_count >= summary_limit or st > cutoff -%}
              {%- break -%}
              {%- endif -%}
              - {{ st.strftime("%H:%M") }} – {{ e.name }}
              {%- set ns.summary_count = ns.summary_count + 1 -%}
              {% endfor -%}
            </details>
            {% endif %}
          {% endif %}

Not saying it’s the best, but it works for me!

1 Like

Discovered that markdown takes GitHub markdown … adding italic was cool.

              {% if e.description %}
                {% set line = line ~ '<br>*' ~ e.description ~ '*' %}
              {% endif %}

1 Like