Coder Social home page Coder Social logo

davisnt / mopidy-alarmclock Goto Github PK

View Code? Open in Web Editor NEW
36.0 7.0 15.0 309 KB

A Mopidy extension for using it as an alarm clock.

Home Page: https://pypi.org/project/Mopidy-AlarmClock/

License: Apache License 2.0

CSS 4.67% JavaScript 24.42% HTML 7.56% Python 63.36%
mopidy mopidy-web-ext

mopidy-alarmclock's Introduction

Mopidy-AlarmClock

Latest PyPI version

Number of PyPI downloads

Coveralls test coverage

A Mopidy extension for using it as an alarm clock.

Mopidy-AlarmClock was originally created by Mathieu Xhonneux and now is maintained by Davis Mosenkovs.

Installation

Install by running:

pip install Mopidy-AlarmClock

Configuration

Optionally alarm defaults can be configured in mopidy.conf config file (the default default values are shown below):

[alarmclock]
# Default alarm time in Hours:Minutes format
def_time = 8:00

# Name or Mopidy URI of default alarm playlist
def_playlist = 

# Default state of Random Track Order (true or false)
def_random = false

# Default alarm volume (integer, 1 to 100)
def_volume = 100

# Default seconds to full volume (integer, 0 to 300)
def_vol_inc_duration = 30

Usage

Make sure that the HTTP extension is enabled. Then browse to the app on the Mopidy server (for instance, http://localhost:6680/alarmclock/).

WARNING! It is strongly recommended to use only local playlists with local media (files) for alarm clock.

Althrough Mopidy-AlarmClock contains some safety measures against playlist/track inaccessibility (e.g. upon network outage) it is still much safer to use local media.

License

Copyright 2014 Mathieu Xhonneux
Copyright 2015-2020 Davis Mosenkovs

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

    http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

Project resources

Changelog

v0.1.9

  • Cosmetic improvements.

v0.1.8

  • Upgraded to Mopidy 3.0+ and Python 3.7+.

v0.1.7

  • Play backup alarm sound when playback cannot be started (within 30 seconds or more).
  • Added warning to readme that only local playlists/media should be used for alarm clock.

v0.1.6

  • Changed branching model to git-flow.
  • Refactoring for improved alarm scheduler.
  • Added backup alarm sound (in case selected playlist is missing).
  • Disable Consume and Single playback modes.
  • Fixed incorrect Mopidy version requirement.
  • Misc refactoring.

v0.1.5

  • Added tests.
  • Fixed nondeterministic effects when cancelling and setting alarm again within 5 seconds (prevent stale idle() timers).
  • Fixed minor math bug in gradual volume increasing.
  • One digit minutes supported in alarm Time.
  • Leading zero for hours of current time in Alarm state.

v0.1.4

  • Alarm defaults can now be configured in mopidy.conf.
  • Display alarm volume on Alarm state.
  • Display current time of alarm clock on Alarm state.
  • Added Travis-CI build and Coveralls test coverage info.
  • Fixed README (to be parsable by PyPI).

v0.1.3

  • Added adjustable volume and gradually increasing volume.
  • Fixed stale message appearing on page reload.
  • Minor internal code changes and interface changes.
  • Updated README/Changelog.

v0.1.2

  • Fixed alarm starting immediately in some situations.
  • Renamed Shuffle Mode to Random Track Order.

v0.1.1

v0.1.0 (UNRELEASED)

mopidy-alarmclock's People

Contributors

davisnt avatar graphgiraffe avatar zashas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

mopidy-alarmclock's Issues

Default settings not showing up

Hi,

I have put the below default settings in mopidy.conf (located on mopidy folder)
for the alarm but even though they are saved I still get the default ones. Am I doing something wrong?

#def_time = 7:30
#def_playlist =
#def_random = false
#def_volume = 18
#def_vol_inc_duration = 15

Capture

Awesome app btw. I also want to try putting a default URI for a Radio station I would like to wake up to. I have several streams on musicbox and some of them are terrible for early morning.

Enhanced scheduler

Enhanced scheduler with repeating alarms (like smartphone alarm clocks have) should be implemented.

More detailed specification of the scheduler is required as well.

Multiple alarms

I'd like to specify an arbitrary number of alarms.

I consider this distinct from #3, as the implementations would be completely unrelated.

Enhanced safety mode

There should be some safeguards against playback stopping during volume increasing period (or may be some time after the period as well) due to technical issues (e.g. lost network connectivity).
A possible safeguard would be using only local media for alarm playlist.

Another possible safeguard would be option that ensures backup alarm is started if playback stops. Such option should be configurable.
The open question is how alarm should be stoppable (with this option enabled). One option would be by changing volume. Another option would be "Stop" button in Alarm Clock interface (it is unclear what it should do - stop adjusting volume; stop the sound etc.?).

Configurable maximum seconds to full volume

Maximum duration till full volume (currently 5 min) should be made configurable.

However there should be safety measures in case playback stops during volume increase period (this might be solved by #10).

Repeat alarm

How can I set the alarm to repeat every morning?
Or, alternatively, how can automatically set an alarmclock from an http call ?

Multi-alarm: mopidy_alarmclock.alarm_manager Could not get current playback volume

Dear @rgov,

I am working on further enhancements on your implementation for multiple alarms and came across to the following error which I can't find any solution...
I was wondering whether you could spend some time and take a look:

Dec 28 14:12:02 raspberrypi mopidy[5459]: INFO     [Thread-51] mopidy_alarmclock.alarm_manager Triggering alarm 14:12 alarm
Dec 28 14:12:03 raspberrypi mopidy[5459]: ERROR    [Thread-51] mopidy_alarmclock.alarm_manager Could not get current playback volume
Dec 28 14:12:03 raspberrypi mopidy[5459]: Traceback (most recent call last):
Dec 28 14:12:03 raspberrypi mopidy[5459]:   File "/usr/local/lib/python3.7/dist-packages/mopidy_alarmclock/alarm_manager.py", line 222, in adjust_volume
Dec 28 14:12:03 raspberrypi mopidy[5459]:     current_volume = self.core.playback.volume.get()
Dec 28 14:12:03 raspberrypi mopidy[5459]:   File "/usr/local/lib/python3.7/dist-packages/pykka/_proxy.py", line 219, in __getattr__
Dec 28 14:12:03 raspberrypi mopidy[5459]:     raise AttributeError('{} has no attribute {!r}'.format(self, name))
Dec 28 14:12:03 raspberrypi mopidy[5459]: AttributeError: <ActorProxy for Core (urn:uuid:edb24319-67b2-4d61-96d2-1aaed19a2052), attr_path=('playback',)> has no attribute 'volume'
`459]:     current_volume = self.core.playback.volume.get()
Dec 28 14:12:03 raspberrypi mopidy[5459]:   File "/usr/local/lib/python3.7/dist-packages/pykka/_proxy.py", line 219, in __getattr__
Dec 28 14:12:03 raspberrypi mopidy[5459]:     raise AttributeError('{} has no attribute {!r}'.format(self, name))
Dec 28 14:12:03 raspberrypi mopidy[5459]: AttributeError: <ActorProxy for Core (urn:uuid:edb24319-67b2-4d61-96d2-1aaed19a2052), attr_path=('playback',)> has no attribute 'volume'

Thanks a lot !

Cannot see spotify playlists

After creating a local playlist, I can't see spotify playlists any more. Only local playlists show up.
Running Mopidy 2.1.0 and Mopidy-Alarmclock 0.1.7, using Iris as a frontend. Spotify playlists play fine through Iris.

Tried clearing ~/.cache/mopidy and reinstalling Mopidy-Alarmclock.

500 Internal Server Error

I have installed alarmclock on my raspberry pi musicbox:
pip install Mopidy-AlarmClock
when I go to http://musicbox/alarmclock/ it works, but when I press "Submit" I get:
500: Internal Server Error
url: http://musicbox/alarmclock/set/
Where could be the problem? what should I do?

feature request: gpio pwm output

Hello,

Not really an issue, more of a request for addition...

First request moved to Issue #2 Google Calendar integration

Would it be difficult to also include setting a GPIO pin on the raspberry pi to rise a PWM signal slowly over half an hour. Ideally I would like to let 1 PWM pin rise from 0 to 100% (yellow "sun"light) over 15 minutes starting half an hour before the alarm, then have a second PWM pin rise from 0 to 100% (bright white light) over 15 minutes. After that it is really time to wake up so then the alarm (music) can start. If it is also possible to set an extra pin to low/high standard and flipped while pwm output is given than it is possible to use a relay to shut off AC power to the lights while they are not used. (saving power)

If all this could be included it would make for a fantastic wakeup light. :)

Mopidy takes a long time to shut down when using Mopidy-AlarmClock

When Mopidy-AlarmClock is loaded (granted, with my changes, but I think this is unrelated to them), service mopidy restart seems to take a loooong time. There are no logs pointing the finger at anything, but my suspicion is that the timer thread (or threads, if they're constantly being created) are not getting the signal to shut down.

I looked around and Mopidy-GMusic also has a repeating timer, and its Pykka-aware backend seems to get an on_stop message that tells it to kill its timer. But I don't know how we can do the same thing without significantly changing.

Doesn't display after installation

Hi,

I've tried installing the extension through pip, but it doesn't seem to work. If I try to get to the URL directly I get a 404 (Iris works, so the HTTP extension is working) and it doesn't show up in the list of HTTP extensions.

Any ideas on how I can find out what might cause the issue?

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.