예제 #1
0
    def __init__(self):
        super().__init__()

        self.title = 'NixLacs GUI - Relacs > Nix > GUI'

        # set MainWindow instance in config / fileInteractions
        Config.setMainWindow(self)
        FileInteractions.setMainWindow(self)

        self.setupUi()

        self.navigation = Navigation(self)
        self.content = Content(self)

        self.sigConfirmDialog.connect(self.displayConfirmDialog)
예제 #2
0
    def process(self, code=140):
        #準備
        #self.sleep()

        url = self.baseURL + str(code)
        #url = self.baseURL  #DEBUG用

        soup = self.getSoup(url)
        self.soup = soup

        table = self.getTable(soup)
        if table != None:
            #データがありそうな場合、データ抽出を行う。
            c = Content.Content()
            c.TITLE = self.getTitle(soup)
            c.CODE = str(code)
            self.cfg.echoMsg(c.CODE + ' : ' + c.TITLE)
            #c.CODE = str(111)
            #IMAGEを取得する
            #完全解剖できていないが、暫定的に[2]を指定する。([0]はロゴ、[1]はアイキャッチ)
            c.IMGURL = self.getImgUrlFromImgTag(self.getImgs(soup)[2])
            trs = self.getTrs(table)
            for i, tr in enumerate(trs):
                atag = self.getA(tr)
                if atag != None:
                    c.appendData([atag.text, self.getUrlFromAtag(atag)])
            #データ出力
            if c.putData(self.cfg.DATADIR) < 1:
                #CSV出力成功した場合、併せて画像取得も行う。
                urllib.urlretrieve(c.IMGURL,
                                   self.cfg.IMGDIR + "\\" + str(code) + ".jpg")
                print 'SUCCESS'
            else:
                print 'FAILED'
            self.contents.append(c)
예제 #3
0
    def __setPreContent__(smali, entry, nPreContentStr):
        nPreContent = Content.Content(entry.getPreContentStr())
        nPreContent.append(nPreContentStr)

        nEntry = smali.getEntry(entry.getType(), entry.getName())
        nEntry.setPreContent(nPreContent)

        smali.modify()
예제 #4
0
파일: Replace.py 프로젝트: loserq/tools
    def getBlankContent(entry):
        content = Content.Content()
        if entry.getType() == SmaliEntry.METHOD:
            contentStr = Replace.__getBlankContentStr__(entry)

            if contentStr is not None:
                content.append(entry.getFirstLine())
                content.append(contentStr)

        return content
예제 #5
0
파일: ClientService.py 프로젝트: serbra/ru
def Login(Username = '',Password = ''):
    x = Content.Application().ClientAppSettings
    x.clientCredential.UserLogin = Username
    x.clientCredential.UserPassword = Password
    x.appSettings.appName ='XBMC'
    temp = req.replace('{BODY}', '<Login xmlns="http://ivsmedia.iptv-distribution.net">' + x.get() + '</Login>')
    soup = BeautifulSoup(Request(temp, 'Login'))
    try:
        x.appSettings.sessionID = soup("b:sessionid")[0].text
    except:
        x.appSettings.sessionID = ""
    return x
예제 #6
0
파일: demo_gui.py 프로젝트: minrat/AI
 def key_down(self, event):
     key = repr(event.char)
     if key == c.KEY_BACK and len(self.history_matrixs) > 1:
         self.matrix = self.history_matrixs.pop()
         self.update_grid_cells()
         print('back on step total step:', len(self.history_matrixs))
     elif key in self.commands:
         self.matrix, done = self.commands[repr(event.char)](self.matrix)
         if done:
             self.matrix = action.add_two(self.matrix)
             # record last move
             self.history_matrixs.append(self.matrix)
             self.update_grid_cells()
             done = False
             if action.game_state(self.matrix) == 'win':
                 self.grid_cells[1][1].configure(
                     text="You", bg=c.BACKGROUND_COLOR_CELL_EMPTY)
                 self.grid_cells[1][2].configure(
                     text="Win!", bg=c.BACKGROUND_COLOR_CELL_EMPTY)
             if action.game_state(self.matrix) == 'lose':
                 self.grid_cells[1][1].configure(
                     text="You", bg=c.BACKGROUND_COLOR_CELL_EMPTY)
                 self.grid_cells[1][2].configure(
                     text="Lose!", bg=c.BACKGROUND_COLOR_CELL_EMPTY)
예제 #7
0
파일: demo_gui.py 프로젝트: minrat/AI
 def init_matrix(self):
     self.matrix = action.new_game(4)
     self.history_matrixs = list()
     self.matrix = action.add_two(self.matrix)
     self.matrix = action.add_two(self.matrix)
예제 #8
0
 def setContentStr(self, contentStr):
     if self.mContent is not None:
         self.mContent.setContentStr(contentStr)
     else:
         self.mContent = Content(contentStr)
예제 #9
0
 def setPreContentStr(self, preContentStr):
     if self.mPreContent is not None:
         self.mPreContent.setContentStr(preContentStr)
     else:
         self.mPreContent = Content(preContentStr)
예제 #10
0
import Content

content = Content.create(title='ffff' text='wewes')
print(content.text)

예제 #11
0
#!/usr/bin/env python
# coding: utf-8

# Simple recommender
# Input: A list of 5 constraints in order, constraints = [genre,year,country,director,actor]. Each element in the input list is either a string or None type
# Output: A dataframe contains 10 recommended movies (information about these movie included)
# Here users input two constraints on genre and year, we use the "get_recommended_movies" function in module Simple_Recommeder to give output.

import Simple_Recommender as sr

print(sr.get_recommended_movies(['Romance','1996',None,None,None])

# Content based recommender
# Input: Movie name: str (The movie id should be in link.csv, keywords.csv, credits.csv at the same time)
# Output: A dataframe contains 10 recommended movies (information about these movie included)
# Here users input a movie name, we use the "get_recommended_movies" function in module Content to give output.

import Content

print(Content.get_recommended_movies('The Dark Knight'))

# Collaborative filtering: user based recommender
# Input: User id: int (The user id should be in original dataset)
# Output: A dataframe contains 10 recommended movies (information about these movie included)
# Here users input his/her own id, we use the "get_recommended_movies" function in module Collaborative to give recommendations.

import Collaborative

print(Collaborative.get_recommended_movies(50))
예제 #12
0
from flask import Flask, render_template, flash
import Content

TOPIC_DICT = Content()

app = Flask(__name__)


@app.route('/')
def homepage():
    return render_template("main.html")


@app.route('/dashboard/')
def dashboard():
    return render_template("dashboard.html", TOPIC_DICT=TOPIC_DICT)


@app.route('/slashboard/')
def slashboard():
    try:
        return render_template("dashboard.html", TOPIC_DICT=shamwow)
    except Exception as e:
        return render_template("500.html", error=str(e))


@app.errorhandler(404)
def page_not_found(e):
    return render_template("404.html")

예제 #13
0
파일: ContentService.py 프로젝트: serbra/ru
def GetClientChannel(SessionID='',
                     filAvailable='false',
                     genChild=[],
                     genCode='',
                     genType='UnknownGenreType',
                     genId='0',
                     genCount='0',
                     genName='',
                     genPar='0',
                     filType='AudioBooks',
                     filDate='0001-01-01T00:00:00',
                     filDateTill='0001-01-01T00:00:00',
                     filFavor='false',
                     filKey='',
                     filOrder='',
                     filShow='false',
                     filStud='0',
                     filVisible='false',
                     pagItems='0',
                     pagNum='0',
                     pagTItems='0',
                     pagTPage='0',
                     sortType='AudioBooks',
                     sortField=[],
                     sortOBy='',
                     sortODir='',
                     type='AudioBooks'):
    body = '<GetClientChannels xmlns="http://ivsmedia.iptv-distribution.net"><sessionID>' + SessionID + '</sessionID>'
    req = Content.ContentRequest()
    fil = Content.ContentFilter()
    pag = Common.ItemPaging()
    sort = Content.ContentSort()
    genre = Content.ContentGenre()
    genre.childrenIDs = genChild
    genre.code = genCode
    genre.genreType = genType
    genre.id = genId
    genre.itemCount = genCount
    genre.parentID = genPar
    fil.availableOnly = filAvailable
    fil.contentGenre = genre
    fil.contentType = filType
    fil.date = filDate
    fil.dateTill = filDateTill
    fil.favoritesOnly = filFavor
    fil.keyWord = filKey
    fil.orderBy = filOrder
    fil.showItems = filShow
    fil.studioID = filStud
    fil.visibleOnly = filVisible
    pag.itemsOnPage = pagItems
    pag.pageNumber = pagNum
    pag.totalItems = pagTItems
    pag.totalPages = pagTPage
    sort.contentType = sortType
    sort.fields = sortField
    sort.orderBy = sortOBy
    sort.orderDirection = sortODir
    req.filter = fil
    req.paging = pag
    req.sort = sort
    req.type = type
    body = body + req.get() + '</GetClientChannels>'
    body = request.replace('{BODY}', body)
    return Request(body, 'GetClientChannels')
def EventLoop(Group):
	
	for i in range(Group[0], Group[1]+1):
		ContentObj = Content("Event_" + str(i))
		DarkGeant4DataObj = DarkGeant4Data(ContentObj.FileContents)
		DarkGeant4DataObj.SaveDarkGeant4Data("DarkGeantData_" + str(i))
예제 #15
0
class NixLacsGUI(QtWidgets.QMainWindow):

    status = QtCore.pyqtSignal(str)
    sigConfirmDialog = QtCore.pyqtSignal(bool)

    def __init__(self):
        super().__init__()

        self.title = 'NixLacs GUI - Relacs > Nix > GUI'

        # set MainWindow instance in config / fileInteractions
        Config.setMainWindow(self)
        FileInteractions.setMainWindow(self)

        self.setupUi()

        self.navigation = Navigation(self)
        self.content = Content(self)

        self.sigConfirmDialog.connect(self.displayConfirmDialog)

    def setupUi(self):

        self.setWindowTitle(self.title)

        # central widget and layout
        self.centralWidget = QtWidgets.QWidget()
        self.centralWidget.setObjectName("centralWidget")
        self.layout = QtWidgets.QVBoxLayout(self.centralWidget)
        self.layout.setObjectName("layout")
        NixLacsGUI.setCentralWidget(self, self.centralWidget)

        ## set menubar
        self.menubar = QtWidgets.QMenuBar()
        self.setMenuBar(self.menubar)

        # file
        self.fileMenu = QtWidgets.QMenu('File')
        self.menubar.addMenu(self.fileMenu)

        # navigation
        self.navigationMenu = QtWidgets.QMenu('Navigation')
        self.menubar.addMenu(self.navigationMenu)

        # analysis
        self.analysisMenu = QtWidgets.QMenu('Analysis')
        self.analysisMenu.addAction(
            'Combine datasets...',
            lambda: self.content.openTab(tabCls=DatasetCombination))
        self.analysisMenu.addAction(
            'Inspect JSON file...',
            lambda: self.content.openTab(tabCls=ExploreJsonFile))
        self.menubar.addMenu(self.analysisMenu)

    def moveToConsole(self):
        '''
        function opens an IPython console
        '''
        embed()

    ################################
    # Dialogs

    def displayConfirmDialog(self,
                             header='Confirmation',
                             message='Are your sure?'):
        result = QtWidgets.QMessageBox.question(
            self, header, message,
            QtWidgets.QMessageBox.Yes | QtWidgets.QMessageBox.No)

        if result == QtWidgets.QMessageBox.Yes:
            return True
        return False
예제 #16
0
파일: brtv.py 프로젝트: akgdrg/ru
                "radio",
                True,
                icon=os.path.join(iconpath, 'icon_radio.png'))
        addItem('Поиск', 'Search',
                True)  #, icon=os.path.join(iconpath, 'icon_tv_live.png'))
        addItem("Настройки", "setting", False, "")
        xbmcplugin.endOfDirectory(int(sys.argv[1]))

    elif mode == "setting":
        addon.openSettings()
        xbmc.executebuiltin('XBMC.Resolution(' +
                            addon.getSetting('resolution') + ')')

    elif mode == 'LiveTV':
        datnow = ContentService.GetUTC()
        channels = Content.Channels()
        sessID = SessionID()
        channels.Invoke(
            ContentService.GetClientChannel(sessID,
                                            type='LiveTV',
                                            pagItems='13',
                                            pagNum=page))
        for channel in channels.items:
            playnow = ContentService.NowPlay(sessID, channel.id, datnow)
            icon = getImage(channel.id, '4')
            name = channel.name + ' - ' + playnow.time + ' ' + playnow.name

            addItem(name, 'LiveStream', False, channel.id, playnow.description,
                    icon)
        if int(channels.TPage) > int(page):
            p = int(page) + 1