How to close the thread?
#16
Thank you, I have deleted the codes in those lines:

Line 284:
Code:
con.close



Line 287 and 288:
Code:
profilePath = profilePath + 'source.db'
con = sqlite3.connect(profilePath)


When I hit on the enter button, it will start to downloading the xml file, but when I hit on the backspace button it still continue to write the data in a database. I have input the correct code as you suggested me to do so.

I cannot use this:

Code:
con = database.connect(':memory:')


It will not find the path of the database location. If you need to take a look at my stuff on on Github, then here it is:

https://github.com/coolguy145/script.tvguide
Reply
#17
I have it working for you and created a pull request.
You can view the changes here:
https://github.com/KenV99/script.tvguide/compare/KenV99



If you have questions that you think others in the forum would benefit from, post back here, otherwise just PM me.

Ken
Reply
#18
Thank you very much for your help ken, I'm having a problem with this line:

Code:
time_interval = int((self.xtime/self.num_steps) 0.5) * 1000


It won't let me to run my code because I'm getting an error: Error Contents: ('invalid syntax', ('C:\\Users\\user\\AppData\\Roaming\\XBMC\\addons\\script.tvguide\\test.py', 7236, 60, ' time_interval = int((self.xtime/self.num_steps) 0.5) * 1000\n'))


Do you have any idea why I'm getting an error?
Reply
#19
Looks like somehow the + sign has been deleted.
Code:
...
        time_interval = int((self.xtime/self.num_steps) + 0.5) * 1000
        status_interval = int(((self.xend-self.xstart)/self.num_steps) + 0.5)

I verified the plus sign is there on my github fork of your script:

Image
Reply
#20
Ooops, it was my fault. I accidentally deleted the + sign when I used the notepad to remove the + sign. So I can see it is working right now. Smile

There are three things I can see that it might need some changes. The first things is when I hit on the backspace button, it have stop writing the data into the database which it is good, but it will not delete the database. Sad

Secondly, when I downloading the xml data from my server, it will put the percent string in the label control and it will input the previous percent strings. Example: It start with 1%, 5%, 12%, 32% then it change it to 6% then 100%. It should continue from 12%, 19%, 26%, 32%, 39% and so on until it get to 100%.

And thirdly, when I hit the enter button to download the xml data from my server and when I hit on the backspace button then hit the enter button again, it supposed to start with 1% but it start with 12% and it will not start to redownload the xml data.

Do you have any idea why?
Reply
#21
All of these issues are due to the fact that you want to implement timers than actual useful status updates. I ran a code time analysis and about 10% of the time is spent downloading and 90% is spent updating the database. I just sent a pull request back to your github with properly implemented status updates for the download and the database. I'm done with the timer idea. If you decide you MUST have it that way, you are on your own.

https://github.com/KenV99/script.tvguide...V99-Proper

Your code is very hard to read and has a lot of duplication. All of the extended calls setting visibility could be handled like:
Code:
if condition:
    x = [2, 5, 6, 8, 10, 15, ...]
    for i in x:
        cSetVisible(self, i, True)
I'm sure you'll realize that there are sets of 'x' that are all the same and you can reuse them over and over, too.

Do yourself a favor and download an IDE like eclipse or PyCharm (I use Pycharm) and setup a debugger.

http://wiki.xbmc.org/index.php?title=HOW...on_scripts

The forums can't be your debugger!
Reply
#22
Thank you very much for your help Ken, you are a star!!!!

Problem solved Smile
Reply

Logout Mark Read Team Forum Stats Members Help
How to close the thread?0