BinaryWorks.it Official Forum
BinaryWorks.it Official Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 eXtreme Movie Manager 8, 9, 10 Forum
 Scripts
 HOWTO (a short guide for scripting)
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

JDommi
Administrator

Germany
4638 Posts

Posted - 24 May 2018 :  11:52:56  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Scripting

How to make a script for XMM
Example: FILMTV.IT

1. Set the script’s description for information purposes (no execution)
-------------------------------------------------
-            eXtreme Movie Manager          -
-            MagicScript Technology           -
-         2001-2016 BinaryWorks.it           - 
-------------------------------------------------- 
- Web :      FilmTV.IT                              -
- Author :   JDommi                                 -
- Date  :    5/June/2013                             -
- Comments:  Import All Information      -
---------------------------------------------------


2. Setup of the script (needed/shown on selecting a script for import)
#MADEBY#=JDommi
#DATEBUILD#=2018-05-14 - 09:38
#WEBSITE#=FilmTV.IT (Italian)
#NOTE#=Importa tutte le informazioni disponibili
#SCRIPTQUALITY#=5
#SCRIPTGENERATION#=3
#REPLACESPACES#=+
#TVSERIES#=FALSE
#SCRIPTFORACTORS#=FALSE
#LANGUAGESORT#=IT
[LANGUAGESORT]=EN=English|IT=Italian|FR=France|DE=Deutsche
#TYPE#=0
[TYPE]=0=Complete|1=Covers|2=Trailers|3=Tunes|4=Subtitles|5=Chains|6=Mistakes|7=Games|8=Adult|9=Anime
#OPTIONS#=1
[OPTIONS]=0=No Options

3. Set the search term
#WEBQUERY#=https://www.filmtv.it/cerca/?q=#MOVIE##film

4. Script specific options (#LOADOPTIONS#)
    #SETOPTION#=#90#1[Importa Galleria Foto]0=Non prendere foto|1=Prendi tutte le foto
    #SETOPTION#=#91#3[Note e Commentari]0=Niente|1=Solo Note|2=Solo Commentari|3=Note e Commentari

5. Set global variables to their values (#SETVARIABLES#)
    #PUT#=0#00#

6. Check if the search term is already a valid link (#RIGHTPAGEFOUND#) for updating an already imported movie

7. Read the list of movies that match the search term (#CREATEMOVIELIST#) and output them this way:
    #WRITETITLELIST#=webaddress    ---> Title [more info if wanted]  §Link to Cover

8. Preload subpages for later use (#LOADWEBSLOTS#) if needed
    #OPENWEBSLOT1#=#03#
    #LOADWEBSLOT1#
    … script code …
    #RESTOREMAIN#
Alternatively use #OPENNEWWEB# … #RESTOREWEB# in other blocks

9. Get all the info of a movie (different blocks)
    See http://www.binaryworks.it/cgi-bin/data/wiki/doku.php?id=programmer_s_guide

10. Special blocks for removing/replacing HTML code constants
#DELETETAGS# #61664; remove phrases from a variable #61664; #DELETEWORD#=Top 250: 
#SUBSTITUTETAGS# #61664; replace HTML code #61664; #SUBSTITUTEWORD#=±=±
#SUBSTITUTEWEBQUERY# #61664; replace HTML code in WEBQUERY’s search term #61664; #SUBSTITUTEWEBQUERYWORD#=#=%23

11. Important commands to set, save or get saved positions (line / cursor)
#COMPUTECURSOR#=+/- value #61664; set the cursor position relatively to it’s current position
#RESETCURSOR# #61664; set cursor to the start of the line
#STARTREADWEB# #61664; set line and cursor to the start
#PUTCURSOR#=#01# #61664; save the cursor position to a variable
#LOADCURSOR#=#01# #61664; reload the cursor position
#SAVEWEBSITELINE# #61664; save the actual websiteline (No variable used)
#RESTOREWEBSITELINE# #61664; reload the actual websiteline (No variable used)

12. Special commands
Search a phrase in the loaded HTML of the website
#FIND#=text#01# #61664; find next occurrence of text in current website line and store the cursor position in variable
#FINDPREVIOUS#=text#01# #61664; find previous occurrence of text in current website line and store the cursor position in variable
#FINDLINE#=text#01# #61664; find next occurrence of text in website lines and store the cursor position in variable
#FINDPREVIOUSLINE#=text#01# #61664; find previous occurrence of text in website lines and store the cursor position in variable
#READNEXTLINE# #61664; read next line of website or
#READNEXTLINE#=2 #61664; read 2 lines of website
#TAKEWORD#=#13#,#01#,#02# #61664; store website line from position 1 to position 2 in variable 13
#CHECKVARIABLE#=#13# #61664; perform replacements on variable #61664; #STARTSUBSTITUTETAGS#, #STARTDELETETAGS#, #CLEARTAGS#, #TRIM#
#STRING#=#13#=text #61664; combine text and/or variable (or multiple phrases)
#PUT#=0#13# #61664; fill a variable with an alphanumerical value

13. Loops and conditions
    #IF# #01#==#02# // ==, <<, >>
    … code or #GOTO#=LABEL // continue with code line :LABEL
    #ENDIF#

    #REPEAT#
    … code …
    #WHILE# #01#==#02#

Use only one condition of the same kind (do not nest them).
You can combine both #IF# and #REPEAT#

14. Take info (different commands)
    See http://www.binaryworks.it/cgi-bin/data/wiki/doku.php?id=programmer_s_guide

15. There are a few more commands but in 99% of all cases you need only the above mentioned.

16. For scripting use either the MagicScript Editor or the ScriptDebugger.
MagicScript Editor is the internal one
ScriptDebugger is a plugin and behaves under rare conditions slightly different but is much more comfortable


In order to achieve what is possible, you have to try the impossible over and over again.
Hermann Hesse

o.baum
Starting Member

Germany
4 Posts

Posted - 14 Jun 2020 :  21:25:45  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Is this template still valid for xmm 10 scripts?
Go to Top of Page

JDommi
Administrator

Germany
4638 Posts

Posted - 14 Jun 2020 :  22:25:51  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Of course. Nothinh has changed on the script engine.

In order to achieve what is possible, you have to try the impossible over and over again.
Hermann Hesse
Go to Top of Page

o.baum
Starting Member

Germany
4 Posts

Posted - 21 Jun 2020 :  12:40:46  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thx Dommy
I always have the problem that request will be aborted (error message: request aborted: no secured SSL/TLS channel can be created
do you know this problem and how to solve it ?
Go to Top of Page

JDommi
Administrator

Germany
4638 Posts

Posted - 21 Jun 2020 :  15:35:27  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
From which site do you wanna grab the data?
I know that some sites can't be scraped (with XMM) like TheTVdb. On others you have to change the https: to simple http: to be automatically redirected. And on some sites the https: works like a charme.
Therefore I can't give you a trick that will work everytime.
For release 10 I have written an additional downloader as plugin that was accepted by XMM's MagicScript Engine...

In order to achieve what is possible, you have to try the impossible over and over again.
Hermann Hesse
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
BinaryWorks.it Official Forum © Binaryworks.it Go To Top Of Page
Generated in 0.12 sec. Powered By: Snitz Forums 2000 Version 3.4.07