Skip to content
Snippets Groups Projects
Commit 65231d1a authored by ale's avatar ale
Browse files

use OSError

parent 3fbed3dc
No related branches found
No related tags found
No related merge requests found
...@@ -4,7 +4,7 @@ import shutil ...@@ -4,7 +4,7 @@ import shutil
import urllib2 import urllib2
from errno import EINVAL, ENOENT from errno import EINVAL, ENOENT
from stat import S_IFDIR, S_IFREG from stat import S_IFDIR, S_IFREG
from fuse import FUSE, FuseOSError, Operations, LoggingMixIn from fuse import FUSE, Operations, LoggingMixIn
class DJFS(LoggingMixIn, Operations): class DJFS(LoggingMixIn, Operations):
...@@ -61,7 +61,7 @@ class DJFS(LoggingMixIn, Operations): ...@@ -61,7 +61,7 @@ class DJFS(LoggingMixIn, Operations):
def _parse_path(self, path): def _parse_path(self, path):
parts = path.split('/') parts = path.split('/')
if len(parts) > 3: if len(parts) > 3:
raise FuseOSError(EINVAL) raise OSError(EINVAL)
if len(parts) < 3: if len(parts) < 3:
parts.extend([None for x in (3 - len(parts))]) parts.extend([None for x in (3 - len(parts))])
return parts return parts
...@@ -71,7 +71,7 @@ class DJFS(LoggingMixIn, Operations): ...@@ -71,7 +71,7 @@ class DJFS(LoggingMixIn, Operations):
if title: if title:
sha1 = self._cache_get(artist, album, title) sha1 = self._cache_get(artist, album, title)
if not sha1: if not sha1:
raise FuseOSError(ENOENT) raise OSError(ENOENT)
stats = self._get('/json/song/%s' % sha1) stats = self._get('/json/song/%s' % sha1)
mtime = float(stats['uploaded_at']) mtime = float(stats['uploaded_at'])
return dict(st_mode=(S_IFREG | 0444), st_nlink=1, return dict(st_mode=(S_IFREG | 0444), st_nlink=1,
...@@ -86,7 +86,7 @@ class DJFS(LoggingMixIn, Operations): ...@@ -86,7 +86,7 @@ class DJFS(LoggingMixIn, Operations):
def readdir(self, path, fh=None): def readdir(self, path, fh=None):
artist, album, title = self._parse_path(path) artist, album, title = self._parse_path(path)
if title: if title:
raise FuseOSError(EINVAL) raise OSError(EINVAL)
if not artist: if not artist:
values = self._get('/json/artists')['artists'] values = self._get('/json/artists')['artists']
elif not album: elif not album:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment