mirror of
https://github.com/spl0k/supysonic.git
synced 2024-12-22 17:06:17 +00:00
parent
25ca4d0dac
commit
f3a12c78b4
@ -8,6 +8,9 @@
|
|||||||
; Optional, restrict scanner to these extensions. Default: none
|
; Optional, restrict scanner to these extensions. Default: none
|
||||||
;scanner_extensions = mp3 ogg
|
;scanner_extensions = mp3 ogg
|
||||||
|
|
||||||
|
; Should the scanner follow symbolic links? Default: no
|
||||||
|
follow_symlinks = no
|
||||||
|
|
||||||
[webapp]
|
[webapp]
|
||||||
; Optional cache directory. Default: /tmp/supysonic
|
; Optional cache directory. Default: /tmp/supysonic
|
||||||
cache_dir = /var/supysonic/cache
|
cache_dir = /var/supysonic/cache
|
||||||
|
@ -61,6 +61,10 @@ restricted to. Useful if you have multiple audio formats in your library but
|
|||||||
only want to serve some. If left empty, the scanner will try to read every file
|
only want to serve some. If left empty, the scanner will try to read every file
|
||||||
it finds.
|
it finds.
|
||||||
|
|
||||||
|
`follow_symlinks`: if set to `yes`, allows the scanner to follow symbolic links.
|
||||||
|
Disabled by default, enable it only if you trust your file system as nothing is
|
||||||
|
done to handle broken links or loops.
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
[base]
|
[base]
|
||||||
; A database URI. See the 'schema' folder for schema creation scripts
|
; A database URI. See the 'schema' folder for schema creation scripts
|
||||||
@ -71,6 +75,9 @@ database_uri = sqlite:////var/supysonic/supysonic.db
|
|||||||
|
|
||||||
; Optional, restrict scanner to these extensions. Default: none
|
; Optional, restrict scanner to these extensions. Default: none
|
||||||
scanner_extensions = mp3 ogg
|
scanner_extensions = mp3 ogg
|
||||||
|
|
||||||
|
; Should the scanner follow symbolic links? Default: no
|
||||||
|
follow_symlinks = no
|
||||||
```
|
```
|
||||||
|
|
||||||
## `[webapp]` section
|
## `[webapp]` section
|
||||||
|
@ -251,6 +251,7 @@ class SupysonicCLI(cmd.Cmd):
|
|||||||
scanner = Scanner(
|
scanner = Scanner(
|
||||||
force=force,
|
force=force,
|
||||||
extensions=extensions,
|
extensions=extensions,
|
||||||
|
follow_symlinks=self.__config.BASE["follow_symlinks"],
|
||||||
progress=TimedProgressDisplay(self.stdout),
|
progress=TimedProgressDisplay(self.stdout),
|
||||||
on_folder_start=self.__unwatch_folder,
|
on_folder_start=self.__unwatch_folder,
|
||||||
on_folder_end=self.__watch_folder,
|
on_folder_end=self.__watch_folder,
|
||||||
|
@ -30,6 +30,7 @@ class DefaultConfig(object):
|
|||||||
BASE = {
|
BASE = {
|
||||||
"database_uri": "sqlite:///" + os.path.join(tempdir, "supysonic.db"),
|
"database_uri": "sqlite:///" + os.path.join(tempdir, "supysonic.db"),
|
||||||
"scanner_extensions": None,
|
"scanner_extensions": None,
|
||||||
|
"follow_symlinks": False,
|
||||||
}
|
}
|
||||||
WEBAPP = {
|
WEBAPP = {
|
||||||
"cache_dir": tempdir,
|
"cache_dir": tempdir,
|
||||||
|
@ -82,6 +82,7 @@ class Daemon(object):
|
|||||||
self.__scanner = Scanner(
|
self.__scanner = Scanner(
|
||||||
force=force,
|
force=force,
|
||||||
extensions=extensions,
|
extensions=extensions,
|
||||||
|
follow_symlinks=self.__config.BASE["follow_symlinks"],
|
||||||
on_folder_start=self.__unwatch,
|
on_folder_start=self.__unwatch,
|
||||||
on_folder_end=self.__watch,
|
on_folder_end=self.__watch,
|
||||||
)
|
)
|
||||||
|
@ -7,9 +7,6 @@
|
|||||||
#
|
#
|
||||||
# Distributed under terms of the GNU AGPLv3 license.
|
# Distributed under terms of the GNU AGPLv3 license.
|
||||||
|
|
||||||
import os.path
|
|
||||||
import uuid
|
|
||||||
|
|
||||||
from flask import current_app, flash, redirect, render_template, request, url_for
|
from flask import current_app, flash, redirect, render_template, request, url_for
|
||||||
from pony.orm import ObjectNotFound
|
from pony.orm import ObjectNotFound
|
||||||
|
|
||||||
@ -17,7 +14,6 @@ from ..daemon.client import DaemonClient
|
|||||||
from ..daemon.exceptions import DaemonUnavailableError
|
from ..daemon.exceptions import DaemonUnavailableError
|
||||||
from ..db import Folder
|
from ..db import Folder
|
||||||
from ..managers.folder import FolderManager
|
from ..managers.folder import FolderManager
|
||||||
from ..scanner import Scanner
|
|
||||||
|
|
||||||
from . import admin_only, frontend
|
from . import admin_only, frontend
|
||||||
|
|
||||||
|
@ -59,6 +59,7 @@ class Scanner(Thread):
|
|||||||
self,
|
self,
|
||||||
force=False,
|
force=False,
|
||||||
extensions=None,
|
extensions=None,
|
||||||
|
follow_symlinks=False,
|
||||||
progress=None,
|
progress=None,
|
||||||
on_folder_start=None,
|
on_folder_start=None,
|
||||||
on_folder_end=None,
|
on_folder_end=None,
|
||||||
@ -71,6 +72,7 @@ class Scanner(Thread):
|
|||||||
|
|
||||||
self.__force = force
|
self.__force = force
|
||||||
self.__extensions = extensions
|
self.__extensions = extensions
|
||||||
|
self.__follow_symlinks = follow_symlinks
|
||||||
|
|
||||||
self.__progress = progress
|
self.__progress = progress
|
||||||
self.__on_folder_start = on_folder_start
|
self.__on_folder_start = on_folder_start
|
||||||
@ -131,8 +133,7 @@ class Scanner(Thread):
|
|||||||
for entry in scandir(path):
|
for entry in scandir(path):
|
||||||
if entry.name.startswith("."):
|
if entry.name.startswith("."):
|
||||||
continue
|
continue
|
||||||
# TODO add config setting to allow following symlinks
|
if entry.is_symlink() and not self.__follow_symlinks:
|
||||||
if entry.is_symlink():
|
|
||||||
continue
|
continue
|
||||||
elif entry.is_dir():
|
elif entry.is_dir():
|
||||||
to_scan.append(entry.path)
|
to_scan.append(entry.path)
|
||||||
|
@ -45,7 +45,7 @@ class ScannerTestCase(unittest.TestCase):
|
|||||||
yield tf
|
yield tf
|
||||||
|
|
||||||
def __scan(self, force=False):
|
def __scan(self, force=False):
|
||||||
self.scanner = Scanner(force)
|
self.scanner = Scanner(force=force)
|
||||||
self.scanner.queue_folder("folder")
|
self.scanner.queue_folder("folder")
|
||||||
self.scanner.run()
|
self.scanner.run()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user