Skip to content

Follow Twitter guidelines for media upload by conforming to the "STAT…#8992

Closed
MikeChristianson wants to merge 3 commits into
home-assistant:devfrom
MikeChristianson:twitter-improved-media-upload
Closed

Follow Twitter guidelines for media upload by conforming to the "STAT…#8992
MikeChristianson wants to merge 3 commits into
home-assistant:devfrom
MikeChristianson:twitter-improved-media-upload

Conversation

@MikeChristianson
Copy link
Copy Markdown
Contributor

@MikeChristianson MikeChristianson commented Aug 15, 2017

Building on the Twitter notification support added in #8282:

Follow Twitter guidelines for media upload by conforming to the "STATUS" phase, when required, and by providing "media_category" information. These changes will, for example, allow users to upload videos that exceed the basic 30 second limit.

notify:
  - name: twitter
    platform: twitter
    consumer_key: 
    consumer_secret: 
    access_token: 
    access_token_secret: 

automation twitter:
  alias: Send a test message
  initial_state: True
  hide_entity: False
  trigger:
    platform: homeassistant
    event: start
  action:
    - service: notify.twitter
      data:
        message: "Test at {{ now().strftime('%I:%M:%S %p') }}."
        data:
          media: /tmp/my-awesome-video.mp4
#          media: /tmp/my-awesome-gif.gif
#          media: /tmp/my-awesome-image.jpg
    - service: homeassistant.turn_off
      entity_id: automation.send_a_test_message

…US" phase, when required, and by providing "media_category" information. These will, for example, allow users to upload videos that exceed the basic 30 second limit.

See:
 - https://twittercommunity.com/t/media-category-values/64781/7
 - https://twittercommunity.com/t/duration-too-long-maximim-30000/68760
 - https://dev.twitter.com/rest/reference/get/media/upload-status.html
@mention-bot
Copy link
Copy Markdown

@MikeChristianson, thanks for your PR! By analyzing the history of the files in this pull request, we identified @fabaff, @HydrelioxGitHub and @pvizeli to be potential reviewers.

_LOGGER.debug("media processing waiting %s seconds to check status",
str(check_after_secs))

time.sleep(check_after_secs)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can not use sleep for that. Use helper/events.py to shedule a callback.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pvizeli I'm not sure how to use helpers/event.py. Could you point me to an example in the hass codebase? (I'm coming up empty.)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@andrey-git
Copy link
Copy Markdown
Contributor

@MikeChristianson any updates on this PR?

@MikeChristianson
Copy link
Copy Markdown
Contributor Author

@andrey-git In progress, slowly.

@MikeChristianson
Copy link
Copy Markdown
Contributor Author

I'm having difficulty implementing the changes requested. I'm closing this PR until I have demonstrable progress.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants