def get_releases(episode, downloaded=None, start=None, stop=None, count=False, descending=False, sort_by=None, session=None):
 releases = session.query(Release).filter((Release.episode_id == episode.id))
 if (downloaded is not None):
  releases = releases.filter((Release.downloaded == downloaded))
 if count:
  return releases.count()
 releases = releases.slice(start, stop).from_self()
 if descending:
  releases = releases.order_by(getattr(Release, sort_by).desc())
 else:
  releases = releases.order_by(getattr(Release, sort_by))
 return releases.all()

def get_releases ( episode , downloaded = None , start = None , stop = None , count = False , descending = False , sort_by = None , session = None ) : releases = session . query ( Release ) . filter ( ( Release . episode_id == episode . id ) ) if ( downloaded is not None ) : releases = releases . filter ( ( Release . downloaded == downloaded ) ) if count : return releases . count ( ) releases = releases . slice ( start , stop ) . from_self ( ) if descending : releases = releases . order_by ( getattr ( Release , sort_by ) . desc ( ) ) else : releases = releases . order_by ( getattr ( Release , sort_by ) ) return releases . all ( )
return all releases for a given episode .