Problem with the log of showtime

Added by Pedro Olivas about 7 years ago

Hi, im trying to develop a plugin... but i've got some problems.

im trying to make a login, but i need to see the full source of the page e.x:

var v = showtime.httpPost("http://blablabla", {
'username':this.credentials.username,
'password':this.credentials.password,
'remember':'1',
'Submit':'LOGIN'
}, {}, {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36'
}, {
'debug': true
});

then i send to the log:

showtime.trace(v)

but it dont shows all the source... only 13 lines...

how i can solve it?

thanx in advice, i hope you can understand me im learning english...


Replies (14)

RE: Problem with the log of showtime - Added by Andreas Smas about 7 years ago

Pedro Olivas wrote:

Hi, im trying to develop a plugin... but i've got some problems.

im trying to make a login, but i need to see the full source of the page e.x:

var v = showtime.httpPost("http://blablabla", {
'username':this.credentials.username,
'password':this.credentials.password,
'remember':'1',
'Submit':'LOGIN'
}, {}, {
'User-Agent': 'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/27.0.1453.94 Safari/537.36'
}, {
'debug': true
});

then i send to the log:

showtime.trace(v)

but it dont shows all the source... only 13 lines...

how i can solve it?

thanx in advice, i hope you can understand me im learning english...

The trace buffer is fixed size per message so it will only write like 2k in there or something.

You can use showtime.print() instead and that will dump all of it to the console.

RE: Problem with the log of showtime - Added by Pedro Olivas about 7 years ago

thanx for your fast awnser, but i tryed that too and doesn't print anything on the log :S but i will check it again ;) thanks u very much

EDIT:

is not working :S

RE: Problem with the log of showtime - Added by Andreas Smas about 7 years ago

Pedro Olivas wrote:

thanx for your fast awnser, but i tryed that too and doesn't print anything on the log :S but i will check it again ;) thanks u very much

EDIT:

is not working :S

On what operating system are you running Showtime?

RE: Problem with the log of showtime - Added by Pedro Olivas about 7 years ago

On ubuntu 13.04, but now its solved, was because i didn't started showtime with the -d option, but i dont know if that command must work only on debug mode...

i have more questions Andreas... the command, showtime.sleep(10); for example its not working even on debug mode, maybe its a bug or something? or it only works on stable releases?

thanx for your help ;)

RE: Problem with the log of showtime - Added by Pedro Olivas about 7 years ago

the icon of the showtime.notify("string", time, "icon"), its not working too..

there is a way to download a mp3 file or mp4? on the hd?

thanx in advice

RE: Problem with the log of showtime - Added by Andreas Smas about 7 years ago

Pedro Olivas wrote:

the icon of the showtime.notify("string", time, "icon"), its not working too..

That's probably a bug. I'll fix that.

there is a way to download a mp3 file or mp4? on the hd?

nope, not really. But I've been thinking about adding support for that.

What do you need it for?

thanx in advice

RE: Problem with the log of showtime - Added by Pedro Olivas about 7 years ago

The first thing i was thinking is the posibility to "auto-update" a plugin on the go.

if i create a plugin, and it's not in your repo, i must download it first,
transfer it to the pendrive, and then install it on the ps3 for example.

or give it to you, and you update the files on your repo, but this is slow.

or make my own repo, but that's not the point.

With that autoupdate, just when you run that plugin, if there is a new version,
just show a message, "there is a new version, download it and install it?"

and if the user clicks ok, install on the moment,

if not, next time when you run the plugin again, tell it,
you have downloaded an update, but it's not installed, install the new update now?

The second thing i was thinking, is make an all-in-one plugin.

Give the posibility to download that song you love,
or the movie/video/images... pkgs on ps3 to install homebrews etc

well, tell me something if you are going to support that, ok?

thanx for all

RE: Problem with the log of showtime - Added by Andreas Smas about 7 years ago

Pedro Olivas wrote:

The first thing i was thinking is the posibility to "auto-update" a plugin on the go.

if i create a plugin, and it's not in your repo, i must download it first,
transfer it to the pendrive, and then install it on the ps3 for example.

or give it to you, and you update the files on your repo, but this is slow.

or make my own repo, but that's not the point.

With that autoupdate, just when you run that plugin, if there is a new version,
just show a message, "there is a new version, download it and install it?"

and if the user clicks ok, install on the moment,

if not, next time when you run the plugin again, tell it,
you have downloaded an update, but it's not installed, install the new update now?

This will just duplicate a lot of work that is already in place.
Did you check out the SPMC stuff? See the SPMC wiki article.

The second thing i was thinking, is make an all-in-one plugin.

Give the posibility to download that song you love,
or the movie/video/images... pkgs on ps3 to install homebrews etc

Yeah, I know there are a lot of good reasons and I agree so I will
try to implement something that works OK.

well, tell me something if you are going to support that, ok?

thanx for all

RE: Problem with the log of showtime - Added by Pedro Olivas about 7 years ago

thanx for the plugin.copyFile() command.

can you explain me a bit, what do the showtime.basename()?
and tell me how to add a progress bar or something to know when the download is finished?

coz i write this:

plugin.copyFile("url", "name");

this downloads the file on the .cache/showtime/plugins/nameplugin/file without none information of when is finished, or where to download the file to
or how to delete.

thanx for your awesome work ;)

RE: Problem with the log of showtime - Added by Andreas Smas about 7 years ago

Pedro Olivas wrote:

thanx for the plugin.copyFile() command.

can you explain me a bit, what do the showtime.basename()?

basename() returns the filename part of a full path so

showtime.basename('/blah/foo/bar') == 'bar'

and tell me how to add a progress bar or something to know when the download is finished?

coz i write this:

plugin.copyFile("url", "name");

this downloads the file on the .cache/showtime/plugins/nameplugin/file without none information of when is finished, or where to download the file to
or how to delete.

Well, it's finished when the function returns.

I agree though that it would be useful to add progress bar in the UI. Not 100% sure how i want to implement that just yet.

Other file manipulation functions will come too as soon as I have time.

thanx for your awesome work ;)

RE: Problem with the log of showtime - Added by Pedro Olivas about 7 years ago

Andreas Öman wrote:

Pedro Olivas wrote:

thanx for the plugin.copyFile() command.

can you explain me a bit, what do the showtime.basename()?

basename() returns the filename part of a full path so

showtime.basename('/blah/foo/bar') == 'bar'

and tell me how to add a progress bar or something to know when the download is finished?

coz i write this:

plugin.copyFile("url", "name");

this downloads the file on the .cache/showtime/plugins/nameplugin/file without none information of when is finished, or where to download the file to
or how to delete.

Well, it's finished when the function returns.

I agree though that it would be useful to add progress bar in the UI. Not 100% sure how i want to implement that just yet.

Other file manipulation functions will come too as soon as I have time.

thanx for your awesome work ;)

it's possible at the moment specify where to download the file? or move the file to specific location?
on ubuntu, how i can specify a location? for example /home/user/Downloads?

thanx mate ;)

RE: Problem with the log of showtime - Added by Andreas Smas about 7 years ago

Pedro Olivas wrote:

it's possible at the moment specify where to download the file? or move the file to specific location?
on ubuntu, how i can specify a location? for example /home/user/Downloads?

I'm a bit reluctant to adding the ability for Showtime to write arbitrary files on the users harddrive.

Any particular reason why you want that?

I could maybe add permissions to the plugin UI so the user will be asked if it's OK for an app to write to any file on the harddrive.

RE: Problem with the log of showtime - Added by Pedro Olivas about 7 years ago

for what i've told you, the posibility downloading music, movies etc, i think it's a must.

On the ps3 for example, i will use the folder dev_hdd0/pkg/
to download directly in that folder pkgs, then when you are on the xmb you can install those pkgs directly.

On ubuntu i dont know how to do it, i want to use the same folder of downloads, like firefox or chrome...

thanks

RE: Problem with the log of showtime - Added by Pedro Olivas about 7 years ago

hi Andreas, how i can use the plugin.filestorage??
i use that prop but showtime tells me plugin.filestorage is not a function :S i'm on the lastest testing release.

thanks

EDIT:

i'm trying the copyFile prop on Navi-X, but i have some questions.

Why where there is more than 1 item, it takes the name and link of the last?

for example

                    if (m.type == "video" || m.type == "image" || m.type == "audio" || m.type == "adult" || m.type == "ps3plus") {
                        var exist = store.exist_in_playlist('favorites', playlist.list[i]);
                        if (!exist.found)
                            item.addOptAction("Añadir a Favoritos Locales", "addFavorite");
                        else
                            item.addOptAction("Borrar de Favoritos Locales", "removeFavorite");

                        item.onEvent('addFavorite', function (item) {
                            if (!store.exist_in_playlist('favorites', playlist.list[this.id]).found) {
                                if (store.add_to_playlist("favorites", playlist.list[this.id])) {
                                    showtime.notify('La entrada se a añadido correctamente a la lista de favoritos.', 5);
                                    page.redirect(PREFIX + ':playlist:playlist:' + playlist.path, "directory");
                                }
                                else
                                    showtime.notify('Ha habido un error mientras se intentaba añadir a tu lista de favoritos', 5);
                            }
                            else {
                                showtime.notify('Ya tienes esa entrada en tu lista.', 5);
                            }
                        });

                        item.onEvent('removeFavorite', function (item) {
                            if (store.exist_in_playlist('favorites', playlist.list[this.id]).found) {
                                if (store.remove_from_playlist("favorites", playlist.list[this.id])) {
                                    showtime.notify('La entrada se quito correctamente de la lista de favoritos.', 5);
                                    page.redirect(PREFIX + ':playlist:playlist:' + playlist.path, "directory");
                                }
                                else
                                    showtime.notify('Ha habido un error mientras se intentaba quitar la entrada de tu lista de favoritos', 5);
                            }
                            else {
                                showtime.notify('No existe la entrada en tus favoritos.', 5);
                            }
                        });

                        item.addOptURL("Ir a la carpeta de Favoritos", PREFIX + ':playlist:playlist:store://favorites', "directory", {
                            title: metadataTitle,
                            icon: cover,
                            description: m.description,
                            url: link
                        });

                        item.addOptSeparator("                                      Descargas                             ");

                        item.addOptAction("Descargar " + m.name, "Descarga");
            var extension = new RegExp(".mp4");
            var extension1 = new RegExp(".flv");
             var extension2 = new RegExp(".mp3");
                        item.onEvent('Descarga', function (item) {
                if (extension.test(link))
                {
                    showtime.notify("Descargando archivo "+ m.name +".mp4", 3);
                    plugin.copyFile(link, m.name +".mp4");
                    return showtime.message("Descarga completada con exito", true, false);
                }
                else if (extension1.test(link))
                {
                    showtime.notify("Descargando archivo "+ m.name +".flv", 3);
                    plugin.copyFile(link, m.name +".flv");
                    return showtime.message("Descarga completada con exito", true, false);
                }
                else
                {
                    showtime.notify("Descargando archivo "+ m.name +".mp3", 3);
                    plugin.copyFile(link, m.name +".mp3");
                    return showtime.message("Descarga completada con exito", true, false);
                }
                        });

            item.addOptURL("Carpeta de Descargas", DESCARGAS, "directory", {
                            title: metadataTitle,
                            icon: cover,
                            description: m.description,
                            url: link
                        });

on this line: item.addOptAction("Descargar " + m.name, "Descarga"); shows the name fine...

can you help me?

(1-14/14)