Commit c88a9219 authored by Gottfried Gaisbauer's avatar Gottfried Gaisbauer
Browse files

swap manually playlist entries via guru

parent 25f1b168
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MarkdownProjectSettings">
<PreviewSettings splitEditorLayout="SPLIT" splitEditorPreview="PREVIEW" useGrayscaleRendering="false" zoomFactor="1.0" maxImageWidth="0" showGitHubPageIfSynced="false" allowBrowsingInPreview="false" synchronizePreviewPosition="true" highlightPreviewType="NONE" highlightFadeOut="5" highlightOnTyping="true" synchronizeSourcePosition="true" verticallyAlignSourceAndPreviewSyncPosition="true" showSearchHighlightsInPreview="false" showSelectionInPreview="true" openRemoteLinks="true">
<PanelProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.panel" providerName="Default - Swing" />
</PanelProvider>
</PreviewSettings>
<ParserSettings gitHubSyntaxChange="false">
<PegdownExtensions>
<option name="ABBREVIATIONS" value="false" />
<option name="ANCHORLINKS" value="true" />
<option name="ASIDE" value="false" />
<option name="ATXHEADERSPACE" value="true" />
<option name="AUTOLINKS" value="true" />
<option name="DEFINITIONS" value="false" />
<option name="DEFINITION_BREAK_DOUBLE_BLANK_LINE" value="false" />
<option name="FENCED_CODE_BLOCKS" value="true" />
<option name="FOOTNOTES" value="false" />
<option name="HARDWRAPS" value="false" />
<option name="HTML_DEEP_PARSER" value="false" />
<option name="INSERTED" value="false" />
<option name="QUOTES" value="false" />
<option name="RELAXEDHRULES" value="true" />
<option name="SMARTS" value="false" />
<option name="STRIKETHROUGH" value="true" />
<option name="SUBSCRIPT" value="false" />
<option name="SUPERSCRIPT" value="false" />
<option name="SUPPRESS_HTML_BLOCKS" value="false" />
<option name="SUPPRESS_INLINE_HTML" value="false" />
<option name="TABLES" value="true" />
<option name="TASKLISTITEMS" value="true" />
<option name="TOC" value="false" />
<option name="WIKILINKS" value="true" />
</PegdownExtensions>
<ParserOptions>
<option name="COMMONMARK_LISTS" value="true" />
<option name="DUMMY" value="false" />
<option name="EMOJI_SHORTCUTS" value="true" />
<option name="FLEXMARK_FRONT_MATTER" value="false" />
<option name="GFM_LOOSE_BLANK_LINE_AFTER_ITEM_PARA" value="false" />
<option name="GFM_TABLE_RENDERING" value="true" />
<option name="GITBOOK_URL_ENCODING" value="false" />
<option name="GITHUB_EMOJI_URL" value="false" />
<option name="GITHUB_LISTS" value="false" />
<option name="GITHUB_WIKI_LINKS" value="true" />
<option name="JEKYLL_FRONT_MATTER" value="false" />
<option name="SIM_TOC_BLANK_LINE_SPACER" value="true" />
</ParserOptions>
</ParserSettings>
<HtmlSettings headerTopEnabled="false" headerBottomEnabled="false" bodyTopEnabled="false" bodyBottomEnabled="false" embedUrlContent="false" addPageHeader="true" embedImages="false" embedHttpImages="false">
<GeneratorProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.generator" providerName="Default Swing HTML Generator" />
</GeneratorProvider>
<headerTop />
<headerBottom />
<bodyTop />
<bodyBottom />
</HtmlSettings>
<CssSettings previewScheme="UI_SCHEME" cssUri="" isCssUriEnabled="false" isCssTextEnabled="false" isDynamicPageWidth="true">
<StylesheetProvider>
<provider providerId="com.vladsch.idea.multimarkdown.editor.swing.html.css" providerName="Default Swing Stylesheet" />
</StylesheetProvider>
<ScriptProviders />
<cssText />
</CssSettings>
<HtmlExportSettings updateOnSave="false" parentDir="$ProjectFileDir$" targetDir="$ProjectFileDir$" cssDir="" scriptDir="" plainHtml="false" imageDir="" copyLinkedImages="false" imageUniquifyType="0" targetExt="" useTargetExt="false" noCssNoScripts="false" linkToExportedHtml="true" exportOnSettingsChange="true" regenerateOnProjectOpen="false" linkFormatType="HTTP_ABSOLUTE" />
<LinkMapSettings>
<textMaps />
</LinkMapSettings>
</component>
</project>
\ No newline at end of file
<component name="MarkdownNavigator.ProfileManager">
<settings default="" pdf-export="" />
</component>
\ No newline at end of file
This diff is collapsed.
......@@ -20,23 +20,46 @@ Any sound supporting linux system should work. It is tested and coded on a **deb
On a debian machine:
```bash
sudo apt install git \
python3 python3-pip \
liquidsoap liquidsoap-plugin-alsa liquidsoap-plugin-ao liquidsoap-plugin-faad \
liquidsoap-plugin-flac liquidsoap-plugin-icecast liquidsoap-plugin-lame \
liquidsoap-plugin-mad liquidsoap-plugin-ogg liquidsoap-plugin-pulseaudio \
liquidsoap-plugin-samplerate liquidsoap-plugin-taglib liquidsoap-plugin-voaacenc \
liquidsoap-plugin-vorbis
sudo apt install \
git \
python3 python3-pip \
redis-server redis-tools \
liquidsoap liquidsoap-plugin-alsa liquidsoap-plugin-flac liquidsoap-plugin-icecast liquidsoap-plugin-pulseaudio \
libev4 libev-dev \
mariadb-server libmariadbclient-dev
```
#### Python Packages
```
sudo pip3 install Flask Flask-Babel flask-babel-utclocal-utils \
flask-mongoengine Flask-RESTful Flask-SQLAlchemy Flask-WTF \
sudo pip3 install \
Flask Flask-Babel Flask-SQLAlchemy Flask-WTF \
mysqlclient redis simplejson
pyev python-dateutil
```
#### get the code
git clone https://gitlab.servus.at/autoradio/engine
#### Set Up a database
mysql -u root -p
CREATE DATABASE aura_engine CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'aura'@'localhost' IDENTIFIED BY 'secure-password';
GRANT ALL PRIVILEGES ON aura_engine.* TO 'aura'@'localhost';
#### Files
Create the audio folder defined in your aura.ini
mkdir /var/audio
mkdir /etc/aura
cp {where you cloned the repo}/configuration/aura.ini /etc/aura/aura.ini
edit installation dir and database settings in aura.ini
#### aura.py
It is the server which is connected to the external programme source, to liquidsoap and is listening for redis pubsub messages.
......
......@@ -38,16 +38,17 @@ class Aura():
# start listener thread
self.messenger.start()
# # ## ## ## ## ## # #
# # ENTRY FUNCTION # #
# # ## ## ## ## ## # #
def main():
aura = Aura()
aura.join_comm()
# # ## ## ## ## ## ## # #
# # End ENTRY FUNCTION # #
# # ## ## ## ## ## ## # #
if __name__ == "__main__":
main()
\ No newline at end of file
......@@ -52,9 +52,9 @@ class Guru:
# help="Add new source to LiquidSoap mixer [Experimental]")
# playlist manipulation
parser.add_argument("-mpe", "--move-playlist-entry", action="store", dest="move_playlist_entry", default=0, metavar=("FROM", "TO"), nargs=2,
help="Move Playlistentry FROM index TO another index")
parser.add_argument("-dpe", "--delete-playlist-entry", action="store", dest="delete_playlist_entry", default=0, metavar=("INDEX"),
parser.add_argument("-mpe", "--swap-playlist-entries", action="store", dest="swap_playlist_entries", default=0, metavar=("FROM", "TO"), nargs=2,
help="Swaps two Playlistentries")
parser.add_argument("-dpe", "--delete-playlist-entry", action="store", dest="delete_playlist_entry", default=0, metavar="INDEX",
help="Delete Playlistentry at INDEX")
parser.add_argument("-ape", "--add-playlist-entry", action="store", dest="add_playlist_entry", default=0, metavar=("INDEX", "FROMTIME", "SOURCE"), nargs=3,
help="Add a new Playlistentry at a given index", type=valid_playlist_entry)
......@@ -94,6 +94,7 @@ class Guru:
if not args.quiet:
print("Guru thinking...")
try:
p = Padavan(args, self.config)
p.meditate()
......
......@@ -207,6 +207,8 @@ class AuraCalendarService(threading.Thread):
schedule_entry.tracknum = entry["tracknum"]
schedule_entry.cdnum = entry["cdnum"]
schedule_entry.year = entry["year"]
if schedule_entry.year == '':
schedule_entry.year = 0
if self.debug:
print("Storing entries... playlist_id: " + str(schedule["playlist_id"]) + " schedule_id: " + str(
......
......@@ -11,29 +11,30 @@ from libraries.database.database import db
class Model:
def store(self, commit=False):
db.session.add(self)
curr_db_sessions = db.session.object_session(self)
curr_db_sessions.add(self)
#db.session.add(self)
if commit:
self.commit()
def commit(self):
@staticmethod
def commit():
db.session.commit()
# def dump_datetime(self, value):
# """Deserialize datetime object into string form for JSON processing."""
# if value is None:
# return None
# return [value.strftime("%Y-%m-%d"), value.strftime("%H:%M:%S")]
# def alchemy_encoder(obj):
# """JSON encoder function for SQLAlchemy special classes."""
# if isinstance(obj, datetime.date):
# return obj.isoformat()
# elif isinstance(obj, decimal.Decimal):
# return float(obj)
def _asdict(self):
return self.__dict__
@staticmethod
def recreate_db():
print("Recreating Database...")
db.drop_all()
print("all dropped. creating...")
db.create_all()
print("all created. commiting...")
db.session.commit()
print("Database recreated!")
# sys.exit(0)
# ------------------------------------------------------------------------------------------ #
class ScheduleModel(Model):
......@@ -57,9 +58,12 @@ class ScheduleEntryModel(Model):
def select_all():
all_entries = ScheduleEntry.query.filter().all()
cnt = 0
for entry in all_entries:
entry.programme_index = cnt
entry.entry_start_unix = time.mktime(entry.entry_start.timetuple())
entry.entry_end_unix = time.mktime(entry.entry_end.timetuple())
cnt = cnt + 1
return all_entries
......@@ -139,6 +143,7 @@ class ScheduleEntry(db.Model, ScheduleEntryModel):
volume = Column(Integer, default=100)
entry_start_unix = 0
entry_end_unix = 0
programme_index = -1
# def __init__(self, playlist_id, entry_num, schedule_id, entry_start, entry_end, source, artist, track, albumname, genre, tracknum, cdnum, year):
......@@ -172,6 +177,7 @@ class ScheduleEntry(db.Model, ScheduleEntryModel):
e.tracknum = tracknum
e.cdnum = cdnum
e.year = year
return e
# @property
# def serialize(self):
......@@ -192,14 +198,5 @@ class ScheduleEntry(db.Model, ScheduleEntryModel):
# show_id = Column(Integer, ForeignKey("timeslot.id"))
def recreateDB():
print("Recreating Database...")
db.drop_all()
print("all dropped. creating...")
db.create_all()
print("all created. commiting...")
db.session.commit()
print("Database recreated!")
sys.exit(0)
#recreateDB()
#Model.recreate_db()
......@@ -8,3 +8,4 @@ class Channels(Enum):
GAP_REPLY = "get_act_programme_reply"
IP_REPLY = "init_player_reply"
PMQ_REPLY = "print_message_queue_reply"
MPE_REPLY = "move_playlist_entry_reply"
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment