Exemple #1
0
def getTitleRepeat(title_name):
    print(title_name)
    dyy = linkDb(db_dyy())
    query_details_id = dyy.query(VideoDetails).filter(
        VideoDetails.title == title_name).first()

    details_id = ''
    if query_details_id:
        details_id = query_details_id.id
    else:
        details_id = None
    return details_id
Exemple #2
0
 def acquire_name(self):
     VideoName = []
     session = self.linkDb(db_dyy())
     details = session.query(VideoDetails).filter(
         VideoDetails.status == 1).all()
     for index in details:
         videodict = {}
         videodict = {
             'id': index.id,
             'title': index.title,
         }
         VideoName.append(videodict)
     # print(VideoName)
     return VideoName
Exemple #3
0
def getDirectorId(director):
    dyy = linkDb(db_dyy())
    query_director = dyy.query(Director).filter(
        Director.name == director).first()

    director_id = ''
    if query_director:
        director_id = query_director.id
    else:
        director = Director(name=director)
        dyy.add(director)
        dyy.commit()

        director_id = director.id

    return director_id
Exemple #4
0
def getStarId(star):
    query_list = []
    if star == []:
        return query_list
    for index in range((len(star))):
        stars = star[index]
        dyy = linkDb(db_dyy())
        query_star = dyy.query(Star).filter(Star.name == stars).first()

        star_id = ''
        if query_star:
            star_id = query_star.id
        else:
            new_star = Star(name=stars)
            dyy.add(new_star)
            dyy.commit()

            star_id = new_star.id

        query_list.append(star_id)

    return query_list
Exemple #5
0
def getVideoTypeId(videotype):
    query_list = []
    if videotype == []:
        return query_list
    for index in range((len(videotype))):
        videotypes = videotype[index]
        dyy = linkDb(db_dyy())
        query_videotype = dyy.query(VideoType).filter(
            VideoType.name == videotypes).first()

        videotype_id = ''
        if query_videotype:
            videotype_id = query_videotype.id
        else:
            new_type = VideoType(name=videotypes)
            dyy.add(new_type)
            dyy.commit()

            videotype_id = new_type.id

        query_list.append(videotype_id)

    return query_list
Exemple #6
0
 def __init__(self):
     engine = db_dyy()
     self.Session = sessionmaker(bind=engine)