Back to Home

By mixing Twitter + Movie we get TwiMov

twitter · movie · startup · development · programming · codeigniter · php · twimov

By mixing Twitter + Movie we get TwiMov

    In this short text, I would like to talk about how the idea was born, how the code was born, and what we have at the moment on my TwiMov project .

    Since childhood, I loved cinema, this fabulous and fantastic world, where it is full of completely unreal things. The world is not limited by anything, only by the imagination of the author. A world that makes you empathize, sympathize, understand. Cinema is not real life, this is virtual reality.

    Since sometimes I just want to say something about the movie that I watched, for example, what graphomania attacks me, that I already can’t keep it in myself and I need to pour it on the keyboard, it's like a memo for myself for the future and again opportunity to analyze the film, I sit down at the computer and write a review. It will turn out successful or not very well known to me and not very exciting, the 80/20 rule is always in my mind. But good, clear reviews with a lot of thoughts, ideas and analysis are the lot of professional authors and journalists, to my delight or regret I am not one of them. Because at some point on one of the topics on our Ufa rock forumI realized that people are not always ready to write large reviews, but they eagerly insert their “five cents”. Well, fortunately, I try to follow all sorts of trends on the network, although the first time I didn’t understand what Twitter was for me, this time it accurately approached my tasks!

    Idea.
    I saw the idea immediately, transparently and easily.
    For example, there is a certain site, it publishes brief notes from different users on different films. Notes are grouped by movie title. Short and laconic as feathers of a sparrow. Since I wanted to tie everything to independent clients, queues and delivery, I immediately chose Twitter, the day I read the API documentation and said that all this is possible without any problems.
    A certain @twimov bot was registered, which is still silent, but will speak soon too :) There are also a number of domains, among which the main one is www.TwiMov.ru . And the work began to boil.

    twimov
    Coding.
    The task of the code was divided into 3 components:
    1. A bot that picks up a feed of calls to it on Twitter at a certain interval of time, checks and processes messages
    2. Frontend, displays reviews, films, user information
    3. Administration and control

    1. Bot. It would seem clear and logical. But why did I decide to do it in Perl, I still don’t understand, took LWP, DBI :: MYSQL, IMAGE :: MAGICK and went to do it ... Yes, somehow everything is tight and tight, then the authorization falls off on LWP, put there was no desire for modules specifically for Twitter, since I already imagined how much code this is for example in PHP. Strange, but this task for me poured into a complete departure in PHP.
    No sooner said than done. For a day, the code was rewritten in "pure" PHP, then everything is different, well, maybe except PDO. A convenient class was written for requests to Twitter, it works through standard file request functions if allow_url_open is enabled, if not through CURL.
    A class was written for parsing Twitter feeds, the fact that there was immediately a hint of the universality of the class helped me quickly create a second object, which also parses a private message feed for reviews.
    BOT as such is the heart and core of filling, it developed with all the ideas that I thought were acceptable in our case, for example:
    - caching user avatars so that at some point they would not lose them and their connection with Twitter.
    - search for the movie cover using Google and also caching it to your server with size adjustment (thanks to this PHPThumb )
    - search the movie trailer in Google as well
    All these points were completed on the whole by 5, cyclically and not all at once, but in the process of work, but I was satisfied and even now there are still ideas to help myself in automation.

    2. The front end . The conclusion was the simplest. I did not drag any old baggage of libraries or modules. I took a clean CodeIgniter framework (sorry, it’s a pity to write on the “noodles”), expanded it with a number of my classes on the Model, on the Front controller and Administrative controller, to make it more convenient and simple.
    I didn’t even draw a design layout, I just took my favorite dark-gothic-emo colors and sketched it in css, then I roughly want to see the site. The design is left for later, the benefit of the MVC architecture will allow me to change it instantly on the entire site. There are a number of “tricks” and my personal rules about extending and writing code for CodeIgniter, which I took for myself from Ruby on Rails, in general it is like naming tables, functions, expanding a model, autoload and initializing them. If someone will be interested to be ready to share and describe them in another article, I'm not greedy, maybe someone will come in handy.

    3. Administration . All again, based on CodeIgniter, a little authorization:
    entrance

    Well, here, too, without special embellishment, the UI designer is none of me, because I always do how convenient it is for my beloved and how quickly I will manage the content myself, as the only site administrator so far. But already a number of chips for myself outlined.

    Immediately determined what and how I want to administer.

    These are reviews individually for all users, with a leaflet on the page and in the future there will be an internal search.
    list of reviews

    review editor

    This is the management of films, next to each film we observe its information and the state of fullness of the cover, video clip, text description with the help of icons.
    movie list

    And a movie editor. I would like to dwell on it a bit.
    Technically, everything is simple, the bot can sometimes make a mistake, just like Google is not uncommon, because the Administrator should be able to independently correct the name of the tape, just “re-upload” the new cover of the film and possibly select a new video file for the trailer for the tape. Of course, it’s possible to independently indicate the address of the image and the video, but basically I try for a number of keywords, again ask Google about their availability, again if anyone is interested in how to work with Google search, ask, I will put a note on the new material. And then the man’s business, looked, chose, indicated. By the way, it is indicated through AJAX so as not to overload such large data arrays. In order not to write my wrapper around all this, I took JQuery as usual, it’s a little unusual to work with it after Prototype, but the wealth of plugins and extensions still forced me to switch to this JS library. The server as usual gives the answers in JSON, it’s more convenient for me.
    movie editor

    And of course, the list of users is also with a leaflet and in the future with a search
    a list of users
    at the moment, so as not to intrude on the privacy of users, they cannot be edited, they always remain with their avatars on the site, but there is the option to BAN, maybe so many harsh measures can come in handy fight against spammers and fluderasts.

    Well, that's all, but now just join www.twitter.com/twimov and write to him in this format.

    @twimov Название фильма+Ваше описание этого супер фильма!

    PS Thanks for the invite and I hope the moderators will post to the Startup blog.
    PPS Thank you for the karma, transferred to "I PR"

    Read Next