Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to create XML according to the selected groups #1

Closed
haxcop opened this issue Mar 4, 2018 · 17 comments
Closed

Unable to create XML according to the selected groups #1

haxcop opened this issue Mar 4, 2018 · 17 comments
Assignees
Labels
bug Something isn't working

Comments

@haxcop
Copy link
Contributor

haxcop commented Mar 4, 2018

Hi, I have been using the python script and it looks really nice, thanks for your work.
anyway. there;s an issue on it that is unable to properly sort the xml when it comes by groups, at least is what i have test it so far.

here;s the error

2Traceback (most recent call last): File "./m3u-epg-editor.py", line 434, in <module> main() File "./m3u-epg-editor.py", line 100, in main xml_tree = create_new_epg(args, epg_filename, m3u_entries) File "./m3u-epg-editor.py", line 375, in create_new_epg output_str("creating channel element for {}".format(channel_id)) File "./m3u-epg-editor.py", line 160, in output_str print("%s %s" % (datetime.datetime.now().isoformat(), event_str)) IOError: [Errno 0] Error

my line goes something like this with Vaders

C:\Python27\python.exe ./m3u-epg-editor.py -m="http://api.vaders.tv/vget?username=username&password=password&format=ts" -e="http://vaders.tv/.xml.gz" -g="'sports','latino','spain','ireland','united kingdom','united states'" -d="C:\Users\Carlos\Documents\Plex-Scripts\m3u_epg_optimizer\m3u-epg-editor" -f="test"

Hope this help you to help US :)

Thanks

@bebo-dot-dev
Copy link
Owner

Hi there thanks for the feedback. I've not seen this problem with my uses so I'll run some tests..I expect this could be related to the data returned for those groups that you're keeping. I'll get back to you.

@bebo-dot-dev
Copy link
Owner

I've had no luck reproducing the problem that you're seeing here yet. However one thing I do notice is that you're a windows user and in your command line, you've specified the path to the python script like this:

C:\Python27\python.exe ./m3u-epg-editor.py

..and I'm not sure this is correct for windows because ./ at the start of m3u-epg-editor.py basically means: use the current folder in linux. Please try something like this instead to see if it helps:

C:\Python27\python.exe "C:\the\full\path\to\m3u-epg-editor.py"

@bebo-dot-dev bebo-dot-dev added question A functionality question pending feedback Pending feedback from the person who created an issue labels Mar 5, 2018
@bebo-dot-dev
Copy link
Owner

Another thing that I noticed in your command line is that this doesn't look like the correct url to the vaderstreams epg file: http://vaders.tv/.xml.gz

@haxcop
Copy link
Contributor Author

haxcop commented Mar 6, 2018

@jjssoftware Thanks for getting back to me - regarding the line
C:\Python27\python.exe ./m3u-epg-editor.py is correct if i'm located in the same folder of m3u-epg-editor.
So to be more exact i do this
C:\Python27\python.exe C:\Users\Carlos\Documents\tools\m3u-epg-editor\m3u-epg-editor.py -m="http://api.vaders.tv/vget?username=usr&password=pssw&format=ts" --epgurl="http://vaders.tv/p2.xml.gz" -g="'sports'" --outdirectory="C:\Users\Carlos\Documents\Plex-Scripts\development\telly\tests" -f="C:\Users\Carlos\Documents\Plex-Scripts\development\telly\tests\Sports_unsorted"

This will create some files

  1. Sports_unsorted.m3u
  2. original.channels.txt
  3. original.m3u
  4. Sports_unsorted.channles.txt
  5. original.gz
  6. original.xml

But then will fail to create sports_unsorted.xml

here are the full output details

`C:\Python27\python.exe C:\Users\Carlos\Documents\tools\m3u-epg-editor\m3u-epg-editor.py -m="http://api.vaders.tv/vget?username=username&password=password&format=ts" --epgurl="http://vaders.tv/p2.xml.gz" -g="'sports'" --outdirectory="C:\Users\Carlos\Documents\Plex-Scripts\development\telly\tests" -f="C:\Users\Carlos\Documents\Plex-Scripts\development\telly\tests\Sports_unsorted"
2018-03-06T11:17:16.773000 performing HTTP GET request to http://api.vaders.tv/vget?username=usr&password=pssw&format=ts
2018-03-06T11:17:17.355000 saving retrieved m3u file: C:\Users\Carlos\Documents\Plex-Scripts\development\telly\tests\original.m3u8
2018-03-06T11:17:17.375000 parsing m3u into a list of objects
2018-03-06T11:17:17.428000 m3u contains 2157 items
2018-03-06T11:17:17.429000 keeping channel groups in this set(['sports'])
2018-03-06T11:17:17.455000 filtered m3u contains 213 items
2018-03-06T11:17:17.457000 saving new m3u file: C:\Users\Carlos\Documents\Plex-Scripts\development\telly\tests\Sports_unsorted.m3u8
2018-03-06T11:17:17.471000 performing HTTP GET request to http://vaders.tv/p2.xml.gz
2018-03-06T11:17:17.582000 saving retrieved epg file: C:\Users\Carlos\Documents\Plex-Scripts\development\telly\tests\original.gz
2018-03-06T11:17:20.609000 extracting retrieved epg file to: C:\Users\Carlos\Documents\Plex-Scripts\development\telly\tests\original.xml
2018-03-06T11:17:21.619000 creating new xml epg for 213 m3u items
2018-03-06T11:17:23.309000 creating channel element for PTVSoprts.pk
2018-03-06T11:17:23.314000 creating channel element for beINSports11.qa
2018-03-06T11:17:23.314000 creating channel element for beINSports12.qa
2018-03-06T11:17:23.319000 creating channel element for SonySix.in
2018-03-06T11:17:23.319000 creating channel element for NeoSports.in
2018-03-06T11:17:23.326000 creating channel element for Ten1.in
2018-03-06T11:17:23.333000 creating channel element for EirSport1.ie
2018-03-06T11:17:23.335000 creating channel element for SkySportsNews.uk
2018-03-06T11:17:23.335000 creating channel element for AtTheRaces.uk
2018-03-06T11:17:23.337000 creating channel element for Eurosport1.uk
2018-03-06T11:17:23.339000 creating channel element for Eurosport2.uk
2018-03-06T11:17:23.342000 creating channel element for MUTV.uk
2018-03-06T11:17:23.345000 creating channel element for BTSport1.uk
2018-03-06T11:17:23.351000 creating channel element for BTSport2.uk
2018-03-06T11:17:23.356000 creating channel element for BTSport3.uk
2018-03-06T11:17:23.359000 creating channel element for BTSportESPN.uk
2018-03-06T11:17:23.362000 creating channel element for ChelseaTV.uk
2018-03-06T11:17:23.364000 creating channel element for LiverpoolFCTV.uk
2018-03-06T11:17:23.366000 creating channel element for MotorsTV.uk
2018-03-06T11:17:23.368000 creating channel element for PremierSports.uk
2018-03-06T11:17:23.370000 creating channel element for RacingUK.uk
2018-03-06T11:17:23.373000 creating channel element for SkySportsF1.uk
2018-03-06T11:17:23.376000 creating channel element for SkySportsMainEvent.uk
2018-03-06T11:17:23.378000 creating channel element for SkySportsPremiereLeague.uk
2Traceback (most recent call last):

File "C:\Users\Carlos\Documents\tools\m3u-epg-editor\m3u-epg-editor.py", line 434, in
main()
File "C:\Users\Carlos\Documents\tools\m3u-epg-editor\m3u-epg-editor.py", line 100, in main
xml_tree = create_new_epg(args, epg_filename, m3u_entries)
File "C:\Users\Carlos\Documents\tools\m3u-epg-editor\m3u-epg-editor.py", line 375, in create_new_epg
output_str("creating channel element for {}".format(channel_id))
File "C:\Users\Carlos\Documents\tools\m3u-epg-editor\m3u-epg-editor.py", line 160, in output_str
print("%s %s" % (datetime.datetime.now().isoformat(), event_str))
IOError: [Errno 0] Error
PS C:\Users\Carlos\Documents\Plex-Scripts\development\telly\tests>`

Hope this gives you a better look

Thanks Again,

@bebo-dot-dev bebo-dot-dev removed the pending feedback Pending feedback from the person who created an issue label Mar 6, 2018
@bebo-dot-dev
Copy link
Owner

Thank you for that but we're not there yet.

I can see the line of Python where it throws the exception / goes wrong but no test that I've performed so far has been able to reproduce this problem and nothing said so far has given any clues to what is causing this.

I do have Windows 7 running in a virtual machine, I'm running this in a regular powershell 5.1 window and it's working ok there. I've emulated / recreated your folder structure to rule out path length related issues as the cause.

Are you running Windows 10? Are you running this in a regular powershell window? If you're in a powershell window, what does this return: $PSVersionTable

This is what mine returns:

Name                           Value
----                           -----
PSVersion                      5.1.14409.1005
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.14409.1005
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1

Do you have any special regional or language settings configured in Windows?

Are you a docker user?

If this is being run in powershell I suspect that this could be unicode / non-unicode related but before I start making changes and ask you test those candidate changes I'd appreciate it if you could answer the questions above. Please also add anything else you can think of that might be a bit non-standard about your setup.

If you are running this in powershell then I guess you could try running this in a regular command prompt (if possible?) to narrow this down to something in powershell as the cause.

@bebo-dot-dev
Copy link
Owner

OK getting closer now. Going on a hunch that you are running Windows 10 and also executing this script in a powershell window, I grabbed a copy of a Windows 10 virtual machine and I've now managed to reproduce this issue.

My steps to reproduce this are a little non-standard but it does reliably reproduce the problem exactly as you've described:

  1. Start powershell
  2. Execute the python script as outlined in your command line example in your comment
  3. As the python script is executing, drag the mouse across the powershell window which causes the script to pause execution and then once paused, hit return to resume script execution

At step 3, I note that sometimes the script will immediately fail with IOError: [Errno 0] Error when it resumes on the first attempt but sometimes it can take 2 or more attempts to get it to fail in this way.

I have also been able to reproduce this problem following the same steps using a regular command prompt window instead of powershell.

I'm not sure if this is how you cause this problem to occur or if something else is triggering this for you.

The good news however is that it's now reliably reproducible here so I should be able to come up with a fix for this.

@bebo-dot-dev bebo-dot-dev added the bug Something isn't working label Mar 6, 2018
@bebo-dot-dev
Copy link
Owner

This appears to be a Windows 10 bug documented here, currently in the process of being fixed but is not yet released.

I'll try and come up with some way of elegantly handling this issue in the meantime so that it doesn't cause the python script to fail.

@bebo-dot-dev
Copy link
Owner

Please see the fix commit applied here: 9a801b4

I've tested this in Windows 10 in both powershell and a regular command prompt and it has fixed this issue for how I was reproducing it. Please give this a test and let me know if it improves things for you.

@bebo-dot-dev bebo-dot-dev added pending feedback Pending feedback from the person who created an issue and removed question A functionality question labels Mar 7, 2018
@haxcop
Copy link
Contributor Author

haxcop commented Mar 9, 2018

@jjssoftware Thanks for your prompt reply on this bug and also my apologies for the delay to reply (Really busy this days at work)... btw you might think of a discord chat will be more straight forward for replies :)/
I will give it a try and let you know.

@bebo-dot-dev
Copy link
Owner

No problem @haxcop there's no rush, thanks for testing it when you have time.

So far as discord / slack / other comms tools go, I have no interest in this sort of thing for my own github projects. I'm sure that issue comments are good enough for the stuff that I work on in here; there's just no need for anything more real-time / engaging.

@haxcop
Copy link
Contributor Author

haxcop commented Mar 10, 2018

HI @jjssoftware the problem remains when it comes to sort the xml file

2018-03-10T15:57:10.584000 creating channel element for I121.100264.schedulesdirect.org
2018-03-10T15:57:10.586000 creating channel element for I401.49609.schedulesdirect.org
2Traceback (most recent call last):
File ".\m3u-epg-editor.py", line 382, in
main()
File ".\m3u-epg-editor.py", line 71, in main
xml_tree = create_new_epg(args, epg_filename, m3u_entries)
File ".\m3u-epg-editor.py", line 325, in create_new_epg
output_str("creating channel element for {}".format(channel_id))
File ".\m3u-epg-editor.py", line 131, in output_str
print("%s %s" % (datetime.datetime.now().isoformat(), event_str))
IOError: [Errno 0] Error
PS C:\Users\Carlos\Documents\Plex-Scripts\development\m3u-epg-editor>

So here's my enviroment details:

Win10
PS C:\WINDOWS\system32> $PSVersionTable

Name Value


PSVersion 5.1.16299.248
PSEdition Desktop
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0...}
BuildVersion 10.0.16299.248
CLRVersion 4.0.30319.42000
WSManStackVersion 3.0
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1

@haxcop
Copy link
Contributor Author

haxcop commented Mar 10, 2018

@jjssoftware Sorry - for some reasson is not working on my Powershell into vs code but i just tried on Native powershell window and didn't gave me any error.

Thanks!.

@bebo-dot-dev
Copy link
Owner

Yes this does sound very much like the Windows 10 bug that I linked to above. Lots of users are reporting issues with the vs code shell in that vs code issue

It sounds like you might have it working isolated in a powershell window rather than vs code however I must say that the line numbers that you've included in your last comment look off. I strongly suspect you're not running the right version which includes the fix that I asked you to test. If that's the case I'm not surprised you're still seeing this problem.

@bebo-dot-dev
Copy link
Owner

Can you confirm that you're testing the patched script or should I just go ahead and merge the candidate fix into the master branch?

@haxcop
Copy link
Contributor Author

haxcop commented Mar 10, 2018

@jjssoftware will do tomorrow thanks

@haxcop
Copy link
Contributor Author

haxcop commented Mar 11, 2018

@jjssoftware works as it should. very nice work thanks!. go ahead and merge

@bebo-dot-dev bebo-dot-dev removed the pending feedback Pending feedback from the person who created an issue label Mar 11, 2018
@bebo-dot-dev
Copy link
Owner

Thanks for confirming @haxcop very much appreciated.

Pull request #3 is merged.

Thanks for finding and reporting this. This issue is now closed. Feel free to open another if you have any more problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants