~jstys-z/helioviewer.org/client5

« back to all changes in this revision

Viewing changes to install/hvpull/browser/localbrowser.py

  • Committer: Keith Hughitt
  • Date: 2012-04-23 16:02:25 UTC
  • mto: This revision was merged to the branch mainline in revision 732.
  • Revision ID: keith.hughitt@nasa.gov-20120423160225-xzoh82ejf37c8yr7
Incorporated HVPull code

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
"""Local data browser"""
 
2
import os
 
3
from hvpull.browser.basebrowser import BaseDataBrowser
 
4
 
 
5
class LocalDataBrowser(BaseDataBrowser):
 
6
    def __init__(self, uri):
 
7
        BaseDataBrowser.__init__(self, uri)
 
8
 
 
9
    def get_directories(self,uri):
 
10
        """Get a list of directories at the passed uri"""
 
11
        return self.get_files(uri, "jp2")
 
12
  
 
13
    def get_files(self, uri, extension):
 
14
        """Get all the files that end with specified extension at the uri"""
 
15
        # ensure the location has the correct suffix
 
16
        if os.path.exists(uri):
 
17
            return os.listdir(uri)
 
18
        else:
 
19
            return []