# Remove/Add Story in Client Repository?

**URL:** <https://casparcgforum.org/t/remove-add-story-in-client-repository/2946>\
**Category:** FAQ\
**Created:** [April 4, 2020, 9:42am UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946 "2020-04-04T09:42:23Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![knoepsche](https://casparcgforum.org/letter_avatar_proxy/v4/letter/k/b487fb/32.png) [@knoepsche](https://casparcgforum.org/u/knoepsche)\
**Post date:** [April 4, 2020, 9:42am UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/1 "2020-04-04T09:42:23Z")

</div>

How’s the client repository workflow?

**my client settings:**  
Repository: [http://localhost:1880/rundowns](http://localhost:1880/rundowns)  
Port: 8250

**my http-Endpoint response:**

```auto
http://localhost:1880/firstRD
http://localhost:1880/secondRD

```

**client dialog "Open Rundown from Repository"**  
 ![image](https://casparcgforum.org/uploads/default/original/1X/906dfdb8088c5d69dafa3ca70bf2239ab31a9e90.png)

**my firstRD:**

```auto
<items>
    <allowremotetriggering>true</allowremotetriggering>
    <item>
        <type>GROUP</type>
        <label>MAZ AMB</label>
        <expanded>true</expanded>
        <channel>1</channel>
        <videolayer>10</videolayer>
        <delay>0</delay>
        <duration>0</duration>
        <allowgpi>false</allowgpi>
        <allowremotetriggering>true</allowremotetriggering>
        <remotetriggerid>11fc6af8:00044626:5c2533ef</remotetriggerid>
        <storyid>11fc6af8:00044626:5c2533ef</storyid>
        <notes></notes>
        <autostep>true</autostep>
        <autoplay>false</autoplay>
        <color>Transparent</color>
        <items>
            <item>...

```

**my firstRD in client:**

 ![image](https://casparcgforum.org/uploads/default/original/1X/576872184fa3170aa740f7918d26972eb07b65a7.png)

**TCP-Message from Client at port 8250:**  
`SUBSCRIBE firstRD localhost:1880`

Your client-code mentions:

```auto
/*
 * Parse incoming command, e.g:
 *
 * ADD\r\n
 * <StoryId>\r\n
 * <xml><data></data></xml>\r\n\r\n
 *
 * The XML format is standard XML client data
 * and must include a valid story ID.
 *
 * REMOVE\r\n
 * <StoryId>\r\n\r\n
 *
 * Story ID is a unique ID of some sort.
 */

```

But I can’t get it to work trying:

```auto
Remove
<storyid>11fc6af8:00044626:5c2533ef</storyid>

```

How is it to remove the Item remotely the right way?

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [April 4, 2020, 10:49am UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/2 "2020-04-04T10:49:25Z")

</div>

Where is this XML specification coming from? MOS protocoll?

---

<div class="post-metadata">

**Author:** ![knoepsche](https://casparcgforum.org/letter_avatar_proxy/v4/letter/k/b487fb/32.png) [@knoepsche](https://casparcgforum.org/u/knoepsche)\
**Post date:** [April 4, 2020, 11:15am UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/3 "2020-04-04T11:15:40Z")

</div>

My xml is just a rundown.xml built for testings where I’ve added the storyId. My repository is a Node Red Client which reads the rundown and delivers it at the http endpoint. I could now add a web-interface to edit the rundown in Node Red and communicate with the client at port 8250 by tcp. Up to the subscription everything works fine.

The code advises I’ve got from  
`https://github.com/CasparCG/client/blob/master/src/Repository/RepositoryDevice.cpp`

---

<div class="post-metadata">

**Author:** ![mint](https://casparcgforum.org/user_avatar/casparcgforum.org/mint/32/2355_2.png) [@mint](https://casparcgforum.org/u/mint)\
**Post date:** [April 4, 2020, 7:02pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/4 "2020-04-04T19:02:16Z")

</div>

> [@didikunz](#):
>
> Where is this XML specification coming from? MOS protocoll?

If _only_ the mos protocol looked this sane 😉

---

<div class="post-metadata">

**Author:** ![Maurice78](https://casparcgforum.org/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Maurice78](https://casparcgforum.org/u/Maurice78)\
**Post date:** [April 5, 2020, 2:15pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/5 "2020-04-05T14:15:15Z")

</div>

Not really sure what you are asking.

But i think the idea is that the “remove” part is something you have to implement your self.  
on the repository side.  
Not really sure how this work as it is a bit of a mystery part off the client 😉

but i guess when the client send’s a “remove” it actually means unsubscribe?  
again not at all sure about this

Although i probably never gona a use it my self i have always been a bit curious how it works.

---

<div class="post-metadata">

**Author:** ![knoepsche](https://casparcgforum.org/letter_avatar_proxy/v4/letter/k/b487fb/32.png) [@knoepsche](https://casparcgforum.org/u/knoepsche)\
**Post date:** [April 5, 2020, 4:02pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/6 "2020-04-05T16:02:49Z")

</div>

**As I understand the commands:**

```auto
* ADD\r\n
 * <StoryId>\r\n
 * <xml><data></data></xml>\r\n\r\n

```

is for adding a story to the loaded rundown in the casparCG-Client

```auto
* REMOVE\r\n
 * <StoryId>\r\n\r\n

```

is for removing a story from the loaded rundown in the casparCG-Client

**What works:**  
The CasparCg-Client loads a rundown from an http endpoint in my remote client.  
Then the CasparCG-Client builds up a tcp connection to my remote client for sending remote commands.

**What is not working:**  
When sending the remove command to the CasparCG client nothing happens there.

I guess my command could be wrong or there has to be a special format of the storyId or something else.

---

<div class="post-metadata">

**Author:** ![Maurice78](https://casparcgforum.org/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Maurice78](https://casparcgforum.org/u/Maurice78)\
**Post date:** [April 5, 2020, 4:26pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/7 "2020-04-05T16:26:22Z")

</div>

did you manage to add a item ?

i must say you shined a new light / gave me a clue on how to use this  
interesting 😉

---

<div class="post-metadata">

**Author:** ![Maurice78](https://casparcgforum.org/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Maurice78](https://casparcgforum.org/u/Maurice78)\
**Post date:** [April 5, 2020, 6:22pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/8 "2020-04-05T18:22:09Z")

</div>

Found it

for REMOVE dont use XML notation

`REMOVE\r\n`  
`itemtodelete\r\n\r\n`

and important the item will not be removed if it has focus in the client !!  
soo make 2items and try again 😉

ow and a other thing the tag for the storyid needs to be lowercase only

`<storyid>itemtodelete</storyid>`

it is badly commented in the code

grt  
Maurice

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [April 5, 2020, 6:47pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/9 "2020-04-05T18:47:04Z")

</div>

> [@knoepsche](#):
>
> ```auto
> * ADD\r\n
> * <StoryId>\r\n
> * <xml><data></data></xml>\r\n\r\n
> 
> ```

Did I understand that right: One line in the client is a “story”, right? So not a bunch of lines making up a news story, what one would expect from the term “StoryId”.

---

<div class="post-metadata">

**Author:** ![Maurice78](https://casparcgforum.org/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Maurice78](https://casparcgforum.org/u/Maurice78)\
**Post date:** [April 5, 2020, 7:06pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/10 "2020-04-05T19:06:22Z")

</div>

yes Didi

it’s a bit odd indeed.  
there are more things in this part that are a bit odd  
i guess there is some heritage there 😉

but a group is also a item soo put a story into a group can do the trick.

---

<div class="post-metadata">

**Author:** ![didikunz](https://casparcgforum.org/user_avatar/casparcgforum.org/didikunz/32/7_2.png) [@didikunz](https://casparcgforum.org/u/didikunz)\
**Post date:** [April 5, 2020, 9:13pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/11 "2020-04-05T21:13:56Z")

</div>

> [@Maurice78](#):
>
> but a group is also a item soo put a story into a group can do the trick.

I actually don’t care, I juast wanted to understand it. 😄

---

<div class="post-metadata">

**Author:** ![knoepsche](https://casparcgforum.org/letter_avatar_proxy/v4/letter/k/b487fb/32.png) [@knoepsche](https://casparcgforum.org/u/knoepsche)\
**Post date:** [April 10, 2020, 8:20pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/12 "2020-04-10T20:20:44Z")

</div>

Thanks Maurice,

With your instructions I can remove groups or items from the rundown now remotely. It is important that nested items can only be deleted with the whole group. They can’t be deleted with their own storyid. And if the item to delete is currently selected it won’t be deleted immediately. But you get a signation (coloured border) to activate “Repository Insert Changes” after going to the next item.

Where I still have problems is how to add items to the rundown. I think I will need some time with this, also.

---

<div class="post-metadata">

**Author:** ![knoepsche](https://casparcgforum.org/letter_avatar_proxy/v4/letter/k/b487fb/32.png) [@knoepsche](https://casparcgforum.org/u/knoepsche)\
**Post date:** [April 11, 2020, 6:11pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/13 "2020-04-11T18:11:41Z")

</div>

To me the right command structure for adding an item is still unclear.  
In node.js I tried something like this:

```auto
var cmdString = "ADD\r\n4\r\n<type>MOVIE</type><devicename>Local CasparCG</devicename><label>TESTPATTERNS/1080I6000_TEST_A</label><name>TESTPATTERNS/1080I6000_TEST_A</name><channel>1</channel><videolayer>10</videolayer><delay>0</delay><duration>0</duration><allowgpi>false</allowgpi><allowremotetriggering>false</allowremotetriggering><remotetriggerid></remotetriggerid><storyid>4</storyid><transition>CUT</transition><tween>Linear</tween><direction>RIGHT</direction><seek>0</seek><length>0</length><loop>false</loop><freezeonload>false</freezeonload><triggeronnext>false</triggeronnext><autoplay>false</autoplay><color>Transparent</color><timecode>00:00:01:29</timecode>\r\n\r\n"
var buffer = Buffer.from(cmdString, 'utf8');

```

Sending this buffer didn’t work. But it is the typical xml of a clip item in the rundown.  
Perhaps I should change the entities before building my buffer from string.  
But it would definetely help to know the right xml structure.

Anybody could help?

---

<div class="post-metadata">

**Author:** ![Maurice78](https://casparcgforum.org/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Maurice78](https://casparcgforum.org/u/Maurice78)\
**Post date:** [April 12, 2020, 8:52am UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/14 "2020-04-12T08:52:58Z")

</div>

hmm

well see if i can get this going as a easter project 😉

---

<div class="post-metadata">

**Author:** ![Maurice78](https://casparcgforum.org/letter_avatar_proxy/v4/letter/m/edb3f5/32.png) [@Maurice78](https://casparcgforum.org/u/Maurice78)\
**Post date:** [April 13, 2020, 1:15pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/15 "2020-04-13T13:15:35Z")

</div>

Hi @knoepsche

this is working on my side  
behind ADD and ‘test’ \<= storyid add  
`\r\n`  
and end with  
`\r\n\r\n`

```auto
ADD
test
<?xml version="1.0" encoding="UTF-8"?><items><allowremotetriggering>false</allowremotetriggering><item><type>MOVIE</type><storyid>test</storyid><devicename>server1</devicename><label>GO1080P25</label><name>GO1080P25</name><channel>1</channel><videolayer>10</videolayer><delay>0</delay><duration>0</duration><allowgpi>false</allowgpi><allowremotetriggering>false</allowremotetriggering><remotetriggerid></remotetriggerid><storyid></storyid><transition>CUT</transition><transitionDuration>1</transitionDuration><tween>Linear</tween><direction>RIGHT</direction><seek>0</seek><length>0</length><loop>false</loop><freezeonload>true</freezeonload><triggeronnext>false</triggeronnext><autoplay>false</autoplay><color>Transparent</color><timecode></timecode></item></items>

```

the client can get upset when linefeeds or carriage returns are in the XML data.  
when a “wrong” message is send it seems that the rundown isn’t listening any more when new requests are send.

grt  
Maurice

---

<div class="post-metadata">

**Author:** ![knoepsche](https://casparcgforum.org/letter_avatar_proxy/v4/letter/k/b487fb/32.png) [@knoepsche](https://casparcgforum.org/u/knoepsche)\
**Post date:** [April 13, 2020, 5:51pm UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/16 "2020-04-13T17:51:57Z")

</div>

😄  
Got it all now working!!!

Thank you for your help!

---

<div class="post-metadata">

**Author:** ![inkvolcano](https://casparcgforum.org/letter_avatar_proxy/v4/letter/i/b9bd4f/32.png) [@inkvolcano](https://casparcgforum.org/u/inkvolcano)\
**Post date:** [August 31, 2024, 6:08am UTC](https://casparcgforum.org/t/remove-add-story-in-client-repository/2946/17 "2024-08-31T06:08:55Z")

</div>

Srry to revive such an old post.

I am looking into this and i cant find any documentation about the fles or services that need to be on the serving side of the repository.

I tried serving it an xml or a html, but i cant get it properly working.

Anyone have an example server file for the repository function?
