Repository navigation
Expand file tree
/
Copy pathplaylist_manager.py
More file actions
47 lines (40 loc) · 1.53 KB
/
Copy pathplaylist_manager.py
File metadata and controls
47 lines (40 loc) · 1.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#
# This file is part of the mpd_rfid distribution (https://github.com/jefure/mpd_rfid).
# Copyright (c) 2022 Jens Reese.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
import argparse
import mpd_handler as mpd
import repository as db
def main():
args = get_args()
conn = db.create_connection()
client = mpd.connect_mpd()
with conn:
db.create_table(conn)
db.store_playlists(mpd.load_playlists(client), conn)
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('-u', '--update',
action='store_true',
help="Update the playlist database")
parser.add_argument('-t', '--test',
action='store_true',
help='Test the reading playlists from mpd server')
parser.add_argument('-n', '--new',
action='store_true',
help='Drop the existing database and create a new one')
return parser.parse_args()
if __name__ == '__main__':
main()